std::string to LPCTSTR

后端 未结 7 1353
甜味超标
甜味超标 2021-02-19 10:30

New version of the typical question of how to convert from std::string to LPCTSTR.

Reading from different SO posts I learnt that I should do th

7条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-19 11:14

    Try to look at this page: What-are-TCHAR-WCHAR-LPSTR-LPWSTR-LPCTSTR-etc. If you are using MSVC, than you may have set Unicode for project and LPCSTR is "translated" to const wchar_t *, which is not compatible with const char *

    By doing this: (LPCTSTR)path.c_str() you are taking two chars from original string and create from them one unicode wchar_t letter. Thats way you are getting "chinese" characters.

提交回复
热议问题