C++ 中 TCHAR 如何转换成std::string类型的?

看这个网址解决的:https://blog.csdn.net/weixin_34023982/article/details/87380020函数

能够利用W2A函数将将_TCHAR *转换为char *,举例:.net

#include "stdafx.h"
#include <stdlib.h>
#include <atlconv.h>  //须要加入的 1

int _tmain(int argc, _TCHAR* argv[])
{
_TCHAR * tchBuffer = L"12345";

USES_CONVERSION; //这两句也要加入2
char *szBuffer = W2A(tchBuffer);//这两句也要加入3

int nNumber = atoi(szBuffer);

printf("nNumber:%d", nNumber);

return 0;
}blog

找到本身程序报错的地方,将上面三句加入便可运行gc

相关文章
相关标签/搜索