StrBufSize function
Return the size of a null-terminated string allocated on the heap.
Declaration
function StrBufSize(Str: PAnsiChar): CardinalDescription
StrBufSize returns the memory allocated for
Str. This function
ONLY gives the correct result if
Str was allocated using
StrAlloc.Errors
If no more memory is available, a runtime error occurs.
See also
Example: ex46
Program Example46;
{ This program demonstrates the StrBufSize function }
{$H+}
Uses sysutils;
Const S = 'Some nice string';
Var P : Pchar;
Begin
P:=StrAlloc(Length(S)+1);
StrPCopy(P,S);
Write (P, ' has length ',length(S));
Writeln (' and buffer size ',StrBufSize(P));
StrDispose(P);
End.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
