64,637
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <string.h>
#include <locale.h>
wchar_t wstr[]=L"宽字符串";
wchar_t wc=L'宽';//一个宽字符
int main() {
_wsetlocale(LC_ALL,L"chs");
wprintf(L"%d %s %c\n",wcslen(wstr),wstr,wc);
return 0;
}
#include <wchar.h>
看看这个头文件就行,字串的改变就是在前面加一个L即可,如L"123123"
两种字符编码都想兼容的话就用_T()宏,需要tchar.h头文件
#include <string>
std::wstring str(L"ABC");