home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource4
/
223_01
/
strncpy.c
< prev
next >
Wrap
Text File
|
1979-12-31
|
512b
|
15 lines
/*
** copy n characters from sour to dest (null padding)
*/
static char *xd;
strncpy(dest, sour, n) char *dest, *sour; int n; {
xd = dest;
while(n-- > 0) {
if(*xd++ = *sour++) continue;
while(n-- > 0) *xd++ = 0;
}
*xd = 0;
return (dest);
}