【发布时间】:2018-03-30 18:27:19
【问题描述】:
错误 C2440:“正在初始化”:无法从“TCHAR [260]”转换为 'std::basic_string
,std::allocator >
我收到了这个错误,卡了几个小时..
TCHAR szModName[MAX_PATH];
if (!GetModuleFileNameEx(hProcess, hMods[i], szModName, sizeof(szModName) / sizeof(TCHAR))) // Get the full path to the module's file
continue;
wstring modName = szModName; <-------- this is what im having problem with
【问题讨论】:
-
至少你没有应用错误的 C 风格转换来消除错误,就像很多人似乎所做的那样(然后想知道为什么他们的程序崩溃或他们的字符串看起来很奇怪)。我对此表示赞赏。