home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / wcscat.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  2KB  |  86 lines

  1. /***
  2. *wcscat.c - contains wcscat() and wcscpy()
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       wcscat() appends one wchar_t string onto another.
  8. *       wcscpy() copies one wchar_t string into another.
  9. *
  10. *       wcscat() concatenates (appends) a copy of the source string to the
  11. *       end of the destination string, returning the destination string.
  12. *       Strings are wide-character strings.
  13. *
  14. *       wcscpy() copies the source string to the spot pointed to be
  15. *       the destination string, returning the destination string.
  16. *       Strings are wide-character strings.
  17. *
  18. *******************************************************************************/
  19.  
  20.  
  21. #include <cruntime.h>
  22. #include <string.h>
  23.  
  24. /***
  25. *wchar_t *wcscat(dst, src) - concatenate (append) one wchar_t string to another
  26. *
  27. *Purpose:
  28. *       Concatenates src onto the end of dest.  Assumes enough
  29. *       space in dest.
  30. *
  31. *Entry:
  32. *       wchar_t *dst - wchar_t string to which "src" is to be appended
  33. *       const wchar_t *src - wchar_t string to be appended to the end of "dst"
  34. *
  35. *Exit:
  36. *       The address of "dst"
  37. *
  38. *Exceptions:
  39. *
  40. *******************************************************************************/
  41.  
  42. wchar_t * __cdecl wcscat (
  43.         wchar_t * dst,
  44.         const wchar_t * src
  45.         )
  46. {
  47.         wchar_t * cp = dst;
  48.  
  49.         while( *cp )
  50.                 cp++;                   /* find end of dst */
  51.  
  52.         while( *cp++ = *src++ ) ;       /* Copy src to end of dst */
  53.  
  54.         return( dst );                  /* return dst */
  55.  
  56. }
  57.  
  58.  
  59. /***
  60. *wchar_t *wcscpy(dst, src) - copy one wchar_t string over another
  61. *
  62. *Purpose:
  63. *       Copies the wchar_t string src into the spot specified by
  64. *       dest; assumes enough room.
  65. *
  66. *Entry:
  67. *       wchar_t * dst - wchar_t string over which "src" is to be copied
  68. *       const wchar_t * src - wchar_t string to be copied over "dst"
  69. *
  70. *Exit:
  71. *       The address of "dst"
  72. *
  73. *Exceptions:
  74. *******************************************************************************/
  75.  
  76. wchar_t * __cdecl wcscpy(wchar_t * dst, const wchar_t * src)
  77. {
  78.         wchar_t * cp = dst;
  79.  
  80.         while( *cp++ = *src++ )
  81.                 ;               /* Copy src over dst */
  82.  
  83.         return( dst );
  84. }
  85.  
  86.