You may want to try using OutputDebugString()
Win32 API.
In Unicode build, which has been the default since VS2005, OutputDebugString()
expands to OutputDebugStringW()
(i.e. the Unicode UTF-16 version of the API, while the ANSI version is OutputDebugStringA()
).
Since OutputDebugString[W]
expects a raw C string pointer, you can use std::wstring::c_str()
method to pass the content of the std::wstring
to the aforementioned API:
// std::wstring sDebug
....
OutputDebugString( sDebug.c_str() ); // (is OutputDebugStringW() in Unicode builds)