[Lazarus] LongString does not work?
Sven Barth
pascaldragon at googlemail.com
Sun Mar 3 10:34:48 CET 2013
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
More information about the Lazarus
mailing list