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 <[email protected]> > 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 > [email protected].**freepascal.org<[email protected]> > http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus> >
-- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
