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

前端 未结 2 563
情深已故
情深已故 2021-01-21 08:55

I have a TCHAR define below:

 TCHAR szProcessName[MAX_PATH] = TEXT(\"\");

and I want to comapare as below:

if(sz         


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-21 09:03

    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 ) instead of TCHAR*.

    example:

    #include 
    #include 
    #include 
    using namespace std;
    int main()
    {
     wstring s = TEXT("HELLO");
     wstring ss = L"HELLO";
     if(s == ss)
      cout << "hello" << endl;
     return 0;
    }
    

提交回复
热议问题