k-tana-zero/libs/libc/strncpy.c
Julien CLEMENT 7178dbb6a7 feat: add given files
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
2021-07-12 15:57:08 +02:00

14 lines
220 B
C

#include <string.h>
#include <stddef.h>
char *strncpy(char *dest, const char *src, size_t n)
{
size_t i;
for (i = 0; i < n && src[i] != '\0'; ++i)
dest[i] = src[i];
memset(dest + i, '\0', n - i);
return dest;
}