[Lazarus] LongString does not work?

Sven Barth pascaldragon at googlemail.com
Sun Mar 3 11:17:10 CET 2013


On 03.03.2013 10:57, Xiangrong Fang wrote:
> Ok, My purpose is to write the record into stream, so I cannot use
> variable length. Now I use an array [0..MaxPathLen] of Char.

If you want to write a complete record to stream (and not write it's 
elements manually) you should declare your record as "packed" as only 
then the records are guaranteed to be the same on different plattforms 
(with the exception of different endianess).

E.g.

=== code begin ===

type
   TConfiguration = packed record
     //
   end;

=== code end ===

See also here: http://community.freepascal.org/docs-html/ref/refsu15.html

Regards,
Sven




More information about the Lazarus mailing list