On 8/31/13, Michael Van Canneyt <mich...@freepascal.org> wrote: > Did you enable ansistrings and object pascal mode ? > Because as it is displayed above, the program will use shortstrings, and > they are limited to 255 chars.
Yes (I typed the example from the top if my head): (ObjFpc mode should not matter though as long as {$H+} is specified?) Here's my very long directory: [bart@localhost 012345679]$ pwd /home/bart/X/01DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD/012345679 Here's the program source: [bart@localhost 012345679]$ cat ~/LazarusProjecten/bugs/findfirst/efn.lpr program efn; {$mode objfpc} {$H+} uses sysutils; var S: String; Len: Integer; begin S := SysUtils.ExpandFileName(ParamStr(1)); Len := Length(S); writeln(Format('%s [Length = %d]',[S,Len])); end. And this is what it outputs. [bart@localhost 012345679]$ ~/LazarusProjecten/bugs/findfirst/efn . /home/bart/X/01DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD [Length = 255] [bart@localhost 012345679]$ At some point a call is made to Procedure getdir(drivenr:byte;var dir:ansistring); (rtl/inc/sysem.inc) This then calls the ShortString version of GetDir() and puts the resulting ShortString back into the AnsiString. Procedure getdir(drivenr:byte;Var dir:ansistring); { this is needed to also allow ansistrings, the shortstring version is OS dependent } var s : shortstring; begin getdir(drivenr,s); dir:=s; end; Bart _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal