Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. LPTSTR convStringToLPTSTR(std::string s)
  2. {
  3.     LPSTR cString = _strdup(s.c_str());
  4.     return cString;
  5. }
  6.  
  7. std::wstring convStringToWidestring(const std::string& s)
  8. {
  9.     int len;
  10.     int slength = (int)s.length() + 1;
  11.     len = MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, 0, 0);
  12.     wchar_t* buf = new wchar_t[len];
  13.     MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, buf, len);
  14.     std::wstring r(buf);
  15.     delete[] buf;
  16.     return r;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement