[fpc-pascal] TProcess.CommandLine > 255 fails

Jürgen Hestermann juergen.hestermann at gmx.de
Sun Jan 4 16:10:52 CET 2009

>> procedure Run_Command_Wait(TheCommand : string); cdecl;
> This 'string' is of the type shortstring, and thus will truncate your
> string to 255 characters.
> Change it in ansistring or add {$H+} to the beginning of your program.

I would advice to declare "TheCommand : AnsiString" instead of changing 
the compiler switch because then it's independend from such 
changes/settings. Especially, when such switches change other things too 
and one day you may need some of these other things and get the side 
effect of changing the string type too.

In general I would advice not to use the generic types "string" (nor 
"integer") at all. It only leads to confusion because noone knows (or is 
aware) of what type is meant in particular. Why not use the strings that 
is needed?

Jürgen Hestermann.

More information about the fpc-pascal mailing list