c++ - How do I store an input from console to a wchar_t variable? -


i creating console program take in directory user through console , store in wchar_t variable.

for example, possible input user:

c:/users/skipher/destop/test.txt 

i found std::wcinand seemed have written wchar_t variable. however, when try print out console again using std::wcout, prints out c out of entire directory.

am writing incorrectly wchar_t variable? saw wchar_t variables hold values in form of l"some kind of string". how can make sure value gets written properly?

std::string stringpath; std::cin.ignore(); std::getline(std::cin, stringpath); std::wstring wstrpath = std::wstring(stringpath.begin(), stringpath.end()); const wchar_t* wcharpath = wstrpath.c_str(); mfilepath = (pxcchar*)wcharpath; 

during debugging, see wstrpath has value want: l"c:/users/skipher/destop/test.txt however, wcharpath has value of 0xcccccccc <error reading characters of string.>

lastly, need store value pxcchar* variable mfilepath typedef wchar_t* provided in sdk. how can long conversion std::string pxcchar*?


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -