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



[Overview][Procedures and functions] Reference for unit 'strings' (#rtl)

strnew

Allocate room for new null-terminated string.

Declaration

Source position: strings.pp line 83

function strnew(

  p: pchar

):pchar;

Description

Copies P to the Heap, and returns a pointer to the copy.

Errors

Returns Nil if no memory was available for the copy.

See also

StrCopy

  

Copy a null-terminated string

StrDispose

  

disposes of a null-terminated string on the heap

Example

Program Example16;

Uses strings;

{ Program to demonstrate the StrNew function. }

Const P1 : PChar = 'This is a PChar string';

var P2 : PChar;

begin
  P2:=StrNew (P1);
  If P1=P2 then
    writeln ('This can''t be happening...')
  else
    writeln ('P2 : ',P2);
  StrDispose(P2);  
end.

Notes

 No notes exist for this page yet. 





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