views:

227

answers:

3

I'm writing a windowed program in C++, but I would like to have the option to pop up a console to output to from inside the program (such as various things that go on behind the scenes of my program, to see that everything is acting correctly). Is there an easy way to do this?

EDIT:

In this particular case I'm using sfml on windows, but for the purposes of this question it can be any API or platform (and platform independent solutions are best)

+3  A: 

If you are talking about MS Windows, which your question does not make clear, you can use the AllocConsole API to create a console. for your app.

Edit: You say that it could be any platform, but this is not so as many platforms have no concept of a console. For this reason, a cross-platform solution is not possible.

anon
+1  A: 

Its easy to just open a console with system("cmd.exe"); But the communication part is not so easy. My intuitive feeling tells me that there exists a third party that satisfied your need. Might be worth looking at win32api or AllocConsole API (if you are using .NET) before experimenting with 3rd party libs.

Schildmeijer
+2  A: 

There are Windows API functions to deal with console management. This might be a good starting point.

Artelius
Thanks, this looks like it ought to do the trick
Alex
I don't think my answer was the best of the list. Shrug.
Artelius