I am trying to format a string using boost:
wchar_t *msg;
// fill msg
boost::format("Error: %s") % msg).str()
What I get instead of msg's content, is the address of msg in hex.
No success with things like these:
boost::format("Error: %s") % new std::wstring(msg)
boost::format("Error: %1%") % msg
Note: Even though I think it's irrelevant, but the way that I fill msg is:
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | 40, NULL, GetLastError(), MAKELANGID(0, SUBLANG_ENGLISH_US), (LPTSTR) &msg, 512, NULL);
and Visual Studio Watch displays the content of msg correctly.
Try using boost::wformat
to work with wchar_t
strings.
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