toaruos/libc/wchar/wcsncpy.c
2018-06-25 18:15:02 +09:00

14 lines
207 B
C

#include <wchar.h>
wchar_t * wcsncpy(wchar_t * dest, const wchar_t * src, size_t n) {
wchar_t * out = dest;
while (n > 0) {
*dest = *src;
if (!*src) break;
dest++;
src++;
n--;
}
return out;
}