11 lines
181 B
C
11 lines
181 B
C
|
|
||
|
#include <string.h>
|
||
|
|
||
|
char * strncpy(char * d, const char * s, size_t n) {
|
||
|
register char * d1 = d;
|
||
|
while (n && *s) { n--; *d++ = *s++; }
|
||
|
while (n--) *d++ = '\0' ;
|
||
|
return d1;
|
||
|
}
|
||
|
|