Skip to content

Instantly share code, notes, and snippets.

@szolotykh
Last active December 16, 2015 23:49
Show Gist options
  • Save szolotykh/1c279600c4a18568ab2c to your computer and use it in GitHub Desktop.
Save szolotykh/1c279600c4a18568ab2c to your computer and use it in GitHub Desktop.
Function of converting char to wchar_t
//Convert char to wchar_t
bool char2wchar_t(char *str1, wchar_t *str2){
std::wstringstream st;
st << str1;
return !(st >> str2).fail();
};
#include <sstream>
char cStr[]="Hello";
wchar_t wStr[10];
char2wchar_t(cStr,wStr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment