简体   繁体   中英

Visual C++ - Find out if started by debugger

I'd like to use

AllocConsole();

or

AttachConsole(ATTACH_PARENT_PROCESS);

depending on if the program was run within visual studio. AttachConsole will not print output to any of the windows like "output". So I'd like to use AllocConsole instead so I get a console window at least.

I found solutions for C# but not for C++ NOT using .NET.

Thanks for answers. I'd appreciate other ways for logging program stuff except writing to files, too :-)

Kai

如果要记录“东西”,以便它在调试器中可见(如果存在),则可能要使用OutputDebugString

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