I am making great headways but I have 2 problems that have been slowing me down for days. The biggest is that I want to save FindFileData.cFileName
as string but I cannot ! Any help ?
I copied this from here: How to convert wstring into string? It converts wstring directly to string ( including FindFileData.cFileName). Any better suggestion or any useful comment ?
#include <clocale>
#include <locale>
#include <string>
#include <vector>
inline std::string narrow(std::wstring const& text)
{
std::locale const loc("");
wchar_t const* from = text.c_str();
std::size_t const len = text.size();
std::vector<char> buffer(len + 1);
std::use_facet<std::ctype<wchar_t> >(loc).narrow(from, from + len, '_', &buffer[0]);
return std::string(&buffer[0], &buffer[len]);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With