Open jaysonpowers-zz opened 5 years ago
I did find a rather unelegant solution:
string temp(woc.szPname); wstring temp2(temp.begin(), temp.end()); sDevices.push_back(temp2);
It's working now at least, hehe.
@mathacka
In one solution, woc.szName
was of type WCHAR, which did not need modification. In another project, it was of type CHAR (when peeking definition) and your modification was needed. Interesting
this solution is not working for me.. it still gives me that same error
change your character set to Unicode character set under Project Configuration Properties->Advanced->Character Set- Use Unicode Character Set. Don't do any code modifications. It works very well once the Unicode is set.
Define using tString = std::basic_string<TCHAR>;
Now simply declare std::vector<tString> devices;
Note: If you are printing, you might want an overloaded function that can use std::string
and std::wstring
line 182 is throwing a type conversion error
sDevices.push_back(woc.szPname);
woc.szPname is a TCHAR array and sDevices is a vector \<wstring>
I haven't found a successful conversion from the two on the internet yet