To use a dynamic array with a procedureMove , you need to pass the first element of the array. For example:
var
Source: Pointer;
SourceSize: Integer;
Destination: array of Byte;
SetLength(Destination, SourceSize);
Move(Source^, Destination[0], SourceSize);
, . , Move , , . , , Move.
, , Destination . , Delphi 2009. Delphi 4, . Move .
GetMem, -cast, , . . , , , , , .
PSP . :
var
Output: array of Byte;
SetLength(Output, OutputLength.Value);
if SendPSPQuery(Char(DriveLetter[1]),
cbxQuery.Items.IndexOf(cbxQuery.Text),
@Output[0],
OutputLength.Value) = 0
then
; , Output , . , . , , , . , , . , , .
, , , , .
, . , , , , Delphi 4. :
type
PByteArray = ^TByteArray;
TByteArray = array[0..0] of Byte;
var
ByteArray: PByteArray;
ByteArray := PByteArray(Output);
for i := 0 to Pred(OutputLength.Value) do begin
{$R-}
edtString.Text := edtString.Text + Chr(ByteArray[i]);
{$R+}
end;
$R , , 1. , , re . . , , , , . ( , .)
PByte Pointer, Delphi new ( Delphi 2009) . PChar, PAnsiChar PWideChar. :
var
Output: PByte;
for i := 0 to Pred(OutputLength.Value) do begin
edtString.Text := edtString.Text + Chr(Output[i]);
end;
$POINTERMATH PByte, , . C , {$POINTERMATH ON} , .
, . . -, , . -, , . , :
var
OutputString: AnsiString;
SetString(OutputString, PAnsiChar(Buffer), OutputLength.Value);
edtString.Text := edtString.Text + OutputString;