|
-
May 19th, 2008, 05:29 AM
#1
how to open console window for debug prints
hello all
i have win32 gui application but when i debug it i need to do debug prints
i was thinking about opening console window and print the debug strings
but how can I open such console ?
-
May 19th, 2008, 05:56 AM
#2
Re: how to open console window for debug prints
You can use OutputDebugString to print debug statements to your VC++ IDE output window. If you still want to create a console window you can use CreateConsoleScreenBuffer.
-
May 19th, 2008, 08:34 AM
#3
Re: how to open console window for debug prints
>> If you still want to create a console window you can use CreateConsoleScreenBuffer
This will not create a console window in GUI app. You can use AllocConsole() to create a console window - but your stdout and stdin descriptors will not be "hooked up" to it - so printf and cout will not work. You can use ReadConsole() and WriteConsole() - or you can "hook up" the CRT to the console to make normal CRT I/O work as expected.
This is an older article on hooking up the CRT to a console, however, it's for the old CRT, not the 8.0 CRT that ships with VS 2005 and up. Although it may still work for the 8.0 CRT.
http://www.halcyon.com/~ast/dload/guicon.htm
gg
-
May 22nd, 2008, 06:53 AM
#4
Re: how to open console window for debug prints
You don't necessarily need a console window to print your debugging information. As already pointed out by another user, you can use OutputDebugString() to print information.
You can use an application like DebugView to view the information printed out (if not the IDE), since it has several advantages over the IDE in what it does.
Nobody can give you wiser advice than yourself. - Cicero
Rajesh Subramanian.
Codeproject.com: Visual C++ MVP
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|