karikari
karikari

Reputation: 6797

cannot convert parameter 1 from 'ATL::CString' to 'const wchar_t *'

For this line of code:

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

I got this error:

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

How to fix?

Upvotes: 0

Views: 2758

Answers (2)

Grim
Grim

Reputation: 987

Try this:

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

Upvotes: 1

pabdulin
pabdulin

Reputation: 35229

Maybe this will work?

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

Also check if Unicode setting of project are set as expected.

Upvotes: 2

Related Questions