频道分类

delphi 合并动态数组

作者:admin 来源: 日期:2012/12/28 15:35:27 人气: 标签:

 

procedure TForm2.btn1Click(Sender: TObject);
var
  arr1, arr2: TBytes;
  len: Integer;
begin
  SetLength(arr1, 3);
  SetLength(arr2, 3);

  arr1[0] := 65;
  arr1[1] := 66;
  arr1[2] := 67;
  arr2[0] := 68;
  arr2[1] := 69;
  arr2[2] := 70;

  len := Length(arr1);
  SetLength(arr1, len + Length(arr2));
  CopyMemory(@arr1[len], arr2, Length(arr2));
  ShowMessage(StringOf(arr1)); { ABCDEF }
end;