hello all
i have code from open source project that im integrating into my code .
now my code settings in visual studio 2008 character set is Unicode . and the external code is
Multi-Byte Character Set. when i change the character setting in my application after adding the new source
im getting other errors in my code .
so reading from the net i guess i need to make some changes to the external code to support unicode.
here is my code :
string FullPathToExe = c:\\foo\\boo.exe;
vector<char> str2(FullPathToExe.begin(), FullPathToExe.end());
str2.push_back('\0');
if (!CreateProcess(NULL,
&str2[0],
NULL,
NULL,
TRUE,
0,
NULL,
NULL,
&si,
&pi))
and the error is :
: error C2664: 'CreateProcessW' : cannot convert parameter 2 from 'char *__w64 '
to 'LPWSTR'
im not win32 programmer and this is new to me.
how can i support both developer that are using multi byte and Unicode ?
Thanks for helping
For the first one use
vector<wchar_t>instead ofvector<char>.For the second one use
L"ERROR: API = %s.\n error code = %d.\n message = %s.\n"instead of"ERROR: API = %s.\n error code = %d.\n message = %s.\n"(note theLat the start.