[Lazarus] LongString does not work?
Xiangrong Fang
xrfang at gmail.com
Sun Mar 3 10:57:51 CET 2013
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.
2013/3/3 Sven Barth <pascaldragon at googlemail.com>
> On 03.03.2013 09:35, Xiangrong Fang wrote:
>
>> Hi All,
>>
>> This does not work:
>>
>> TConfiguration = record
>> DataFolder: string[MaxPathLen];
>> end
>>
>> Error: string length must be a value from 1 to 255
>>
>> I already have this on the top of my uinit file: {$mode
>> objfpc}{$H+}{$LONGSTRINGS ON}
>>
>> Working with Lazarus 1.0.6/FPC2.6.0 on Linux 3.5/x86_64
>>
>> Any hint please? Thanks!
>>
>
> The "String[...]" declaration always declares a ShortString and those can
> have only 1 to 255 characters. An AnsiString does not need the "[...]",
> because it has always variable length.
>
> Side note: {$H+} and {$LONGSTRINGS ON} is redundant, both mean the same
> (though {$H+} is more commonly used).
>
> Regards,
> Sven
>
>
> --
> ______________________________**_________________
> Lazarus mailing list
> Lazarus at lists.lazarus.**freepascal.org<Lazarus at lists.lazarus.freepascal.org>
> http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130303/113d1a0c/attachment-0003.html>
More information about the Lazarus
mailing list