[fpc-pascal] pchar with more than 255 characters

Sven Barth pascaldragon at googlemail.com
Wed Nov 16 17:24:50 CET 2011


Am 16.11.2011 17:15, schrieb Felipe Monteiro de Carvalho:
> On Tue, Nov 15, 2011 at 11:33 AM, Jonas Maebe<jonas.maebe at elis.ugent.be>  wrote:
>> length(pchar) is translated into strlen(pchar) (just like in Delphi).
>
> But why is it limited to 255 chars in {$H-} ? (I understood that it is
> limited like this from the original poster)

If you look at the call the original poster sent, you will see why:

> For example:
> getchars( '12345 ... 255256257258' +
>                 '1234567213939873987' +
>                ...
>                ...
>                 '1234567213939873987');  // more than 255 chars

FPC converts the constant string to the current generic string type 
which is String[255] in case of {$H-} and not AnsiString. Thus the 
string will appear truncated after 255 characters.

Regards,
Sven



More information about the fpc-pascal mailing list