XINU
strncpy.c
Go to the documentation of this file.
1 
15 char *strncpy(char *s1, const char *s2, int n)
16 {
17  register int i;
18  register char *os1;
19 
20  os1 = s1;
21  for (i = 0; i < n; i++)
22  {
23  if (((*s1++) = (*s2++)) == '\0')
24  {
25  while (++i < n)
26  {
27  *s1++ = '\0';
28  }
29  return os1;
30  }
31  }
32  return os1;
33 }
char * strncpy(char *s1, const char *s2, int n)
文字列s1に文字列s2をN文字(Byte)分コピーする。
Definition: strncpy.c:15