home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 1.ddi / CLIB1.ZIP / STPCPY.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-07  |  1.8 KB  |  50 lines

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