error C2446: == : no conversion from const char * to TCHAR *

a 夏天 提交于 2019-12-01 23:46:27

"NDSClient.exe" is a const char* string on windows. If you want it to become a const TCHAR* then you need to use the TEXT macro. Also, you can not compare strings using == use a equivalent TCHAR function such as _tcscmp.

Mihran Hovsepyan

Also you can use. L"some string" to make TCHAR*. But I suggest you to use std::wstring (analog of std::string and as std::string needs #include <string>) instead of TCHAR*.

example:

#include <windows.h>
#include <string>
#include <iostream>
using namespace std;
int main()
{
 wstring s = TEXT("HELLO");
 wstring ss = L"HELLO";
 if(s == ss)
  cout << "hello" << endl;
 return 0;
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!