[fpc-pascal] Byte array manipulation

Andrew Brunner andrew.t.brunner at gmail.com
Mon Aug 17 05:58:55 CEST 2009


Hi there,

I have a ByteArray unit that's pretty extensive.

function toString(Var Item:TByteArray):string
var
  iLen:Integer;
begin
  iLen:=System.Length(Item);
  SetLength(Result,iLen);
  if iLen>0 then
    System.Move(Item[0],Result[1],iLen);
end;

On Sun, Aug 16, 2009 at 12:35 PM, Wimpie Nortje<wimpienortje at gmail.com> wrote:
> Hi all,
>
> I have a lot of byte arrays which contains mostly text but also #0. I am
> looking for functions to manipulate these arrays.
>
> The stuff in strutils are mainly what I need but they operate on strings
> which is not usable to me due to the #0. Are there any such functions in
> FPC?
>
> And while I am onto strings...does anyone know of a quick and easy way to
> convert strings to a byte array. Much like aPchar := PChar(aString)?
>
> Thanks
> Wimpie
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



More information about the fpc-pascal mailing list