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



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

strcopy

Copy a null-terminated string

Declaration

Source position: strings.pp line 27

function strcopy(

  dest: pchar;

  source: pchar

):pchar;

Description

Copy the null terminated string in Source to Dest, and returns a pointer to Dest. Dest needs enough room to contain Source, i.e. StrLen(Source)+1 bytes.

Errors

No length checking is performed.

See also

StrPCopy

  

Copy a pascal string to a null-terminated string

StrLCopy

  

Copy a null-terminated string, limited in length.

StrECopy

  

Copy a null-terminated string, return a pointer to the end.

Example

Program Example4;

Uses strings;

{ Program to demonstrate the StrCopy function. }

Const P : PCHar = 'This is a PCHAR string.';

var PP : PChar;

begin
  PP:=StrAlloc(Strlen(P)+1);
  STrCopy (PP,P);
  If StrComp (PP,P)<>0 then
    Writeln ('Oh-oh problems...')
  else
    Writeln ('All is well : PP=',PP);
  StrDispose(PP);  
end.

Notes

 No notes exist for this page yet. 





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