Friday 15 March 2013

Delphi, Copy string to Byte array -


What I have done, but I see that the fastest way to copy a string into pByteArray is

from sysutils

  PByteArray = ^ TBiiteArere; TBITE array = array [0..32767] byte; Assume  

one and s is setup correctly

  a: pByteArray; S: string;  

A quick way to do this is to copy something like

  i: = 1 for length - 1 ^ ^ [ii]: = ord (S [ii]);  

Delphi 7

Be careful with the use of move if you Instead of using Delphi 2009, it may fail, instead, use it:

Go (S [1], a ^, length (s) * size off (four));

You can also use Class Tencoding in SysUtils.pas (Delphi 2009/2010 ++ only) to work.


No comments:

Post a Comment