How can I convert from CString to std::wstring?
- 2Please see this: stackoverflow.com/questions/258050/…codaddict– codaddict2010-01-11 10:48:35 +00:00Commented Jan 11, 2010 at 10:48
- 1and stackoverflow.com/questions/859304/…Idan K– Idan K2010-01-11 10:52:27 +00:00Commented Jan 11, 2010 at 10:52
Add a comment |
4 Answers
Try this:
std::wstring strString((LPCTSTR)strCString); 1 Comment
sbi
Why use a C cast for that? A fellow-worker of mine once was in the position that he had to find explicit casts, as some of them didn't work on the platform he needed to port a 4MLoC project to. He praised everyone who used C++' explicit casts (you can grep for them) and fought hard to ban all C-style casts, since they were so hard to find.