How can I convert a GUI C++ application to a console application?
- 9your question is very vague, please explain your question better? If you have a C++ gui app with windows and toolbars, you can't convert it into console, unless of course you have a separated shell code then maybe you can re-write the shell.gideon– gideon2011-03-02 05:38:07 +00:00Commented Mar 2, 2011 at 5:38
Add a comment |
2 Answers
A good way to start is to separate the "business logic" from the "display logic". That way you can keep the business logic the same, but rewrite the parts that display it on the screen to write to standard output instead. However, if your application already has them mixed together, it's not always easy to separate them out; ideally you want to start with the logic decoupled.
Other than that, you'll want to use std::cout to write to the console, and compile the application as a console application instead of a GUI one.
2 Comments
Tim
You can also use ncurses to hack together an ascii-art gui. Very rudimentary and not recommended for significant projects, but it can work for simple things.
0xC0000022L
If you use curses, don't forget the CDK which makes some curses jobs easier ;)