Today, some people ask the function use problem, I will test it myself, by the way to learn.
Uses Math;procedure Tform2.button1click (sender:tobject); type ttarraybyte= array of Byte;var Fsource: Pansichar; Farraybyte:ttarraybyte; Fsourcelenth:integer; Hexstr:string;begin Fsource: = ' 123 '; Fsourcelenth: = Length (Fsource),////string=pchar=pwidechar single Kanji extraction length is 1 SetLength (Farraybyte, fsourcelenth); CopyMemory (@FArrayByte [0], Fsource, fsourcelenth); Move (Fsource,farraybyte[0],min (fsourcelenth,8)); farraybyte[0]:=99; Move (Fsource[1],farraybyte[1],min (fsourcelenth,2)); HEXSTR: = "; For fsourcelenth: = 0 to Fsourcelenth do begin Hexstr: = hexstr + Inttohex (Farraybyte[fsourcelenth], 2); End; ShowMessage (HEXSTR); ShowMessage (Pansichar (farraybyte)); end;
CopyMemory (array value address, array value address, length)
CopyMemory Move using Notes