I have a GUI C++ application (Visual Studio 2008) that needs to be converted to a console one. I don't have any experience in C programming. Mostly I use .NET. Where do I start?
-
3`int main(int argc, char *argv[]);` is where you start. – Bertrand Marron Mar 14 '10 at 12:11
4 Answers
Start with refactoring. Make sure that GUI is separated from business logic. Then add another interface to access this business logic: one that uses console, rather than GUI widgets.

- 8,047
- 1
- 30
- 37
Down-converting a GUI app is major surgery. The programming model is entirely different, a GUI app is event driven. Relying on a message loop to deliver events, processed in message handlers. And typically a bunch of controls that take care of the grunge work of taking input.
Given that you have to completely redesign the app to make it work as a console mode app and that you don't have experience with the language, writing this in a .NET language you have experience with is the best way to get it completed quickly.

- 922,412
- 146
- 1,693
- 2,536
-
I'm attempting to execute a function before the call to CreateDialog, and the application crashes in crtexe.c, "Access Violation". How to fix the issue? – SharpAffair Mar 16 '10 at 12:22
-
2My crystal ball is cloudy, it can't see "a function". I can only recommend using a debugger. Please read this: http://catb.org/~esr/faqs/smart-questions.html – Hans Passant Mar 16 '10 at 12:27
Check out ncurses and readline to help you build a rich console application. You can't use them both at once, as I found out, so try ncurses if your application is more oriented toward output/display or will implement single-key interactions (hotkeys), and readline if it's more of a line-at-a-time user input situation.

- 1
- 1

- 239,568
- 38
- 324
- 436
- Create a new project with a main
- add your files
- here you got a console application doing nothing. It may still create windows, or if you like, hidden windows.
- Now it's up to your creativity to tie interface to existing code.
- Don't forget to download and use boost::program_options to access command line parameters properly.

- 18,794
- 5
- 57
- 67