I need to convert Unicode version of ReadDirectoryChangesW to support multibyte is that possible
Asked
Active
Viewed 206 times
0
-
Do you mean "convert the FILE_NOTIFY_INFORMATION::FileName member from Unicode to multibyte"? Use the answers to your previous question, here: http://stackoverflow.com/questions/1525456/converting-unicode-to-multibyte – Éric Malenfant Oct 06 '09 at 15:39
1 Answers
-1
You can cast a multi byte string into a unicode string by using this simple method
#include <string>
#include <sstream>
template <typename inputtype>
std::wstring toUTF16String(const inputtype& input)
{
std::wstringstream ss;
ss << input;
return ss.str();
}
You can then use this acquired value in the unicode function.

Charles
- 2,615
- 3
- 29
- 35
-
Warning: (Assuming that inputtype is std::string or const char*): This converts each char individually, with the widen() method of the global locale's char_traits facet, and is thus unsuitable for any multibyte encoding. – Éric Malenfant Oct 06 '09 at 20:28