home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / XSTRCAT.C < prev    next >
C/C++ Source or Header  |  1997-07-05  |  887b  |  44 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4. **  XSTRCAT.C - String concatenation function
  5. **
  6. **  Notes: 1st argument must be a buffer large enough to contain the
  7. **         concatenated strings.
  8. **
  9. **         2nd thru nth arguments are the string to concatenate.
  10. **
  11. **         (n+1)th argument must be NULL to terminate the list.
  12. */
  13.  
  14. #include <stdarg.h>
  15. #include "snip_str.h"
  16.  
  17. #if defined(__cplusplus) && __cplusplus
  18.  extern "C" {
  19. #endif
  20.  
  21. char *xstrcat(char *des, char *src, ...)
  22. {
  23.         char *destination = des;
  24.         va_list v;
  25.  
  26.         va_start(v, src);
  27.  
  28.         while (src != 0)
  29.         {
  30.                 while (*src != 0)
  31.                         *des++ = *src++;
  32.                 src = va_arg(v, char *);
  33.         }
  34.         *des = 0;
  35.  
  36.         va_end(v);
  37.  
  38.         return destination;
  39. }
  40.  
  41. #if defined(__cplusplus) && __cplusplus
  42.  }
  43. #endif
  44.