// wcscat.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdlib.h>
#include <string.h>
/*
原型:_INTRIMP wchar_t *wcscat(
wchar_t *strDestination, //'\0'结尾的目标字符串
const wchar_t *strSource //'\0'结尾的源字符串
);
用法:#include <stdlib.h>
功能:把strSource所指字符串添加到strDestination结尾处,覆盖strDestination结尾处的'\0'并添加'\0'。
说明:strSource和strDestination所指内存区域不可以重叠且
strDestination必须有足够的空间来容纳strSource的字符串。
返回值 : 返回指向strDestination的指针.
No return value is reserved to indicate an error.
备注 : 因为wcscat在strDestination追加strSource前不进行检查,
这是一个缓冲区溢出的潜在原因。故使用时应注意。推荐使用wcscat_s替代.
*/
int main(int argc, char* argv[])
{
wchar_t dest[20]=L"hello ";
wchar_t *src=L"world";
wcscat(dest,src);
wprintf(L"%s\n",dest);
printf("sizeof(dest):%d\n",sizeof(dest));
return 0;
}
/*
hello world
sizeof(dest):40
Press any key to continue
*/