home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_10_10
/
1010016a
< prev
next >
Wrap
Text File
|
1992-08-12
|
382b
|
19 lines
Listing 4 -- the file strncat.c
/* strncat function */
#include <string.h>
char *(strncat)(char *s1, const char *s2, size_t n)
{ /* copy char s2[max n] to end of s1[] */
char *s;
for (s = s1; *s != '\0'; ++s)
; /* find end of s1[] */
for (; 0 < n && *s2 != '\0'; --n)
*s++ = *s2++; /* copy at most n chars from s2[] */
*s = '\0';
return (s1);
}