help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'sysutils' (#rtl)

StrBufSize

Return the size of a null-terminated string allocated on the heap.

Declaration

Source position: syspchh.inc line 48

function StrBufSize(

  Str: PChar

):SizeUInt;

Description

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

StrAlloc

  

Allocate a null-terminated string on the heap.

StrDispose

  

Dispose of a null-terminated string on the heap.

Example

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.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505