我正在尝试复制传递给函数的char16_t*
,但却找不到任何方法。
foo(char16_t* characters) {
char16_t* copiedCharacters;
//copy characters to copiedCharacters
}
我尝试使用strncopy()
,但它只复制char*
。
答案 0 :(得分:2)
有一种已知的结构(借用strcpy):
char16_t* str16cpy(char16_t* destination, const char16_t* source)
{
char16_t* temp = destination;
while((*temp++ = *source++) != 0)
;
return destination;
}
答案 1 :(得分:-1)
char16_t *mystrcpy(char16_t *dest, const char16_t *src)
{
unsigned i;
for (i=0; src[i] != '\0'; ++i)
dest[i] = src[i];
dest[i] = '\0';
return dest;
}