home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_02_12 / 2n12050a < prev    next >
Text File  |  1991-10-29  |  478b  |  16 lines

  1. Function StrAssign(VAR Dest:PCHAR; Source:PCHAR):PCHAR;
  2. { Allocate memory and copy  existing  source to dest.  This first
  3.   deallocates dest's memory if required. }
  4. begin
  5.     if Dest <> NIL then StrDispose(Dest);{ Deallocate Dest }
  6.     if (Source = NIL) OR (Source[0] = #0) then
  7.         Dest := NIL   { No source string so return NIL }
  8.     else
  9.     begin
  10.         GetMem(Dest, StrLen(Source)+1 ); { +1 for the 0 byte }
  11.         StrCopy(Dest, Source)
  12.     end
  13. end;
  14.  
  15.  
  16.