How do I convert a GUI C++ application to a console application?
How can I convert a GUI C++ application to a con开发者_Go百科sole application?
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.
If you're asking how to convert your existing VS project from GUI to console, look at project properties under Linker/System, and set the SubSystem to Console.
精彩评论