[fpc-pascal]absolute identifier
Carlo Kok
ck at carlo-kok.com
Wed Apr 10 21:16:14 CEST 2002
----- Original Message -----
From: "ron wilson" <ron.wilson at coastgames.com>
To: <fpc-pascal at deadlock.et.tudelft.nl>
Sent: Wednesday, April 10, 2002 9:09 PM
Subject: RE: [fpc-pascal]absolute identifier
> how about for type casting?
>
> var
> buf: array[1..255] of char;
> buflen: byte;
> str: ansistring;
> ...
> str:=ansistring(buf);
> setlength(str,buflen);
>
> should i setlength before typecasting?
That should not work.
Better do something like:
SetLength(Str, BufLen);
Move(Buf, Str[1], BufLen);
or
SetString(Str, Pchar(@Buf), BufLen);
More information about the fpc-pascal
mailing list