質問

I want to output a wstring to the output window (I hope that is what it is called in English).

enter image description here

But it does not do that.

Does anybody see where I went wrong?

役に立ちましたか?

解決

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)
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top