wcscpy ()- 复制宽字符字符串
格式
#include <wchar.h>
wchar_t *wcscpy(wchar_t *string1, const wchar_t *string2);
语言级别
XPG4
线程安全
是
宽字符函数
有关更多信息,请参阅 宽字符 。
描述
wcscpy()
函数将 string2 (包括结尾 wchar_t 空字符) 的内容复制到 string1中。
wcscpy()
函数对空结束的 wchar_t 字符串进行操作; 此函数的字符串自变量应包含标记字符串结束的 wchar_t 空字符。 仅 string2 需要包含空字符。 未执行边界检查。
返回值
wcscpy()
函数返回指向 string1的指针。
示例
此示例将 source 的内容复制到 destination。
#include <stdio.h>
#include <wchar.h>
#define SIZE 40
int main(void)
{
wchar_t source[ SIZE ] = L"This is the source string";
wchar_t destination[ SIZE ] = L"And this is the destination string";
wchar_t * return_string;
printf( "destination is originally = \"%ls\"\n", destination );
return_string = wcscpy( destination, source );
printf( "After wcscpy, destination becomes \"%ls\"\n", destination );
}
/**************** Output should be similar to: ******************
destination is originally = "And this is the destination string"
After wcscpy, destination becomes "This is the source string"
*/