1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <stdlib.h> #include <wchar.h> wchar_t *wcsdup(const wchar_t *s) { size_t l = wcslen(s); wchar_t *d = malloc((l+1)*sizeof(wchar_t)); if (!d) return NULL; return wmemcpy(d, s, l+1); } #ifdef TEST int main(void) { return 0; } #endif