Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OutputDebugString doesn't print information in Visual Studio 2010

I've been trying to get OutputDebugString to work with no avail. My code follows:

int main(int argc, char* argv[])
{
    OutputDebugStringA("asd");
    getchar();
    return 0;
}

When I run the application without debugging, DebugView shows asd but when I debug my application (F5), it doesn't print my string in Output or Intermediate window.

I've tried OutputDebugString with asd but nothing changed. What can be the problem?

like image 637
holgac Avatar asked Dec 04 '22 17:12

holgac


1 Answers

You should terminate the string with "\n", but this should be only a cosmetic thing. I have tried your code right now and I can see the asd string in the Output window of VS 2010 without any issues.

Note: in the context menu of the Output pane (accessible using right mouse click) you can select which information should be displayed in the pane. Make sure you have enabled "Program output". Also make sure you are watching the correct window (Output or Immediate) depending on your setting "Redirect all Output window text to the Immediate window" in Tools/Options/Debugging/General.

like image 114
Suma Avatar answered Feb 17 '23 06:02

Suma