4

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?

mmmmmm
  • 32,227
  • 27
  • 88
  • 117
tmighty
  • 10,734
  • 21
  • 104
  • 218

1 Answers1

12

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());
RichieHindle
  • 272,464
  • 47
  • 358
  • 399