How to output new line in Visual Studio actions?
Here are four things for you to try:
You can produce a line break using the debugger expression
{"\n",s8b}
which makes use of the C++ debugger format specifiers8b
(unquoted 8-bit string).Here's an example with a two-line message
First{"\n",s8b}Second
:(Other than that, I am not aware of any other way to include line breaks in the message. While there are ways to enter a multi-line message (by entering line break characters' Unicode code points using the numpad), Visual Studio will just throw away everything but the first text line entered.)
Just before your current breakpoint, add an additional breakpoint with a very short action message (a dot or comma) in order to get an additional line break before your real message.
If you're on Windows (which appears likely, given Visual Studio), you can send a message to the debugger using the Windows API function
OutputDebugString
. This is the currently suggested solution to the SO question, "How do I print to the debug output window in a Win32 app?"Write a message to
clog
:std::clog << message << std::endl;
.
In Addition to the answer from stakx that matches the original question for debugging C++ applications, I would like to add a character sequence that instead works for debugging .NET applications:
{"\n",nq}
The C++ sequence would otherwise result in this error message: 's8b' is not a valid format specifier