diff options
Diffstat (limited to 'src/wchar/wcsncpy.c')
-rw-r--r-- | src/wchar/wcsncpy.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/wchar/wcsncpy.c b/src/wchar/wcsncpy.c new file mode 100644 index 00000000..ebae8133 --- /dev/null +++ b/src/wchar/wcsncpy.c @@ -0,0 +1,18 @@ +#include <wchar.h> + +wchar_t * wcsncpy(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n) +{ + size_t i; + int nul = 0; + for (i = 0; i < n; i++) { + s1[i] = nul ? s2[i] : L'\0'; + if (s1[i] == L'\0') { + nul = 1; + } + } + return s1; +} + +/* +STDC(199409) +*/ |