home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 1.ddi / CLIBSRC1.ZIP / _STPCPY.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.3 KB  |  46 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - stpcpy.c
  3.  *
  4.  * function(s)
  5.  *        _stpcpy - copies one string to another
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #include <string.h>
  18.  
  19. /*---------------------------------------------------------------------*
  20.  
  21. Name            _stpcpy - copies one string to another
  22.  
  23. Usage           char *_stpcpy(char *destin, const char *source)
  24.  
  25. Prototype in    string.h
  26.  
  27. Description     _stpcpy copies the bytes of source into destin and stops after
  28.                 copying the terminating null character of source. _stpcpy (a, b)
  29.                 is the same as strcpy (a, b) except that the return values
  30.                 differ.
  31.  
  32.                 strcpy(a, b) returns a, while _stpcpy (a, b) returns a +
  33.                 strlen (b).
  34.  
  35. Return value    returns destin + strlen(source);
  36.  
  37. *---------------------------------------------------------------------*/
  38. char *_stpcpy(char *to, const char *from)
  39. {
  40.         register unsigned len;
  41.  
  42.         len = strlen(from);
  43.         memcpy(to, from, len+1);
  44.         return (to+len);
  45. }
  46.