Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string myName;
- getline( cin , myName );
- wstring printerName( L(myName) ); // error C3861: 'L': identifier not found
- wchar_t* WprinterName = printerName.c_str(); // error C2440: 'initializing' : cannot convert from 'const wchar_t *' to 'wchar_t *'
- inline std::wstring convert( const std::string& as )
- {
- // deal with trivial case of empty string
- if( as.empty() ) return std::wstring();
- // determine required length of new string
- size_t reqLength = ::MultiByteToWideChar( CP_UTF8, 0, as.c_str(), (int)as.length(), 0, 0 );
- // construct new string of required length
- std::wstring ret( reqLength, L'