[fpc-pascal]Length function on ansistrings

Peter Vreman peter at freepascal.org
Sat Jan 4 01:19:28 CET 2003

At 00:45 4-1-2003, you wrote:
>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?

It returns the actual length. The maximumlength is only used for internal 


More information about the fpc-pascal mailing list