[fpc-pascal]Length function on ansistrings

Mark Emerson mark at angelbase.com
Sat Jan 4 00:45:06 CET 2003


Does the Length function applied to an ansistring return (1) the actual
length of the string (determined by the position of the null terminator)
or (2) the maximum length allocated for the string (recorded in a
longint just below the first character)?

Someone told me the answer is (2) and to guarantee getting the actual
length, one must use Length (Pchar(s)), where s is an ansistring.  Is
this true?

Mark




More information about the fpc-pascal mailing list