无法将参数1从'ATL :: CString'转换为'const wchar_t *'

时间:2011-05-04 08:19:22

标签: visual-c++

对于这行代码:

   int currentSnapshotHeight = _wtoi(ExecuteExternalProgram(L"current.png"));

我收到了这个错误:

Error 1 error C2664: '_wtoi' : cannot convert parameter 1 from 'ATL::CString' to 'const wchar_t *'  

如何解决?

2 个答案:

答案 0 :(得分:1)

也许这会有用吗?

int currentSnapshotHeight = _wtoi(ExecuteExternalProgram(_T("current.png")));

同时检查项目的Unicode设置是否按预期设置。

答案 1 :(得分:1)

试试这个:

int currentSnapshotHeight = _wtoi((wchar_t*)ExecuteExternalProgram(L"current.png").GetBuffer());
相关问题