简体   繁体   中英

C++ OutputDebugStringW with newline

I want to attach a new line to the OutputDebugStringW.

OutputDebugStringW(Item.pItem);

pItem is a LPCWSTR, not a wstring, so I could not directly add new line by saying + "/n".

Can somebody help?

Just output the newline in a separate call to OutputDebugStringW :

OutputDebugStringW(Item.pItem);
OutputDebugStringW(L"\n");

If for some reason you only want to make a single call to OutputDebugStringW , build a string first:

std::wstringstream ss;
ss << Item.pItem << L"\n";
OutputDebugStringW(ss.str().c_str());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM