Sign in Join
FPDoc Onlineexperiment

strpcopy function

In unit Strings

Copy a pascal string to a null-terminated string.

Declaration

pascal
function strpcopy(d: PAnsiChar; const s: shortstring): PAnsiChar

Description

Converts the Pascal string in Se to a Null-terminated string, and copies it to D. D needs enough room to contain the string Source, i.e. Length(S)+1 bytes.

Errors

No length checking is performed.

See also

Example: ex2

pascal
Program Example2;

Uses strings;

{ Program to demonstrate the StrPCopy function. }

Const S = 'This is a normal string.';

Var P : Pchar;

begin
  p:=StrAlloc (length(S)+1);
  if StrPCopy (P,S)<>P then
    Writeln ('This is impossible !!')
  else
    writeln (P);
  StrDispose(P);  
end.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.