Reputation: 1801
I have created a Win32 Console Application in Visual Studio but when I start the program the console apears just for a second and then disapears again. What should I do that the console remains on the screen ?
Upvotes: 1
Views: 219
Reputation: 2590
This is happening because the program has nothing to wait for before exiting.
Try running std::cin.get();
before main()
returns to make the console wait for keyboard input.
Upvotes: 0
Reputation: 2987
You can set breakpoints anywhere in your code to make it stop. If you just want to see the output of the program when it's done, try setting a breakpoint on the last line of main().
Upvotes: 0
Reputation: 210445
Well, the program has finished running, so it closes.
Either make the program wait for input (e.g. with getchar()
), or press Ctrl-F5 to run the program without debugging (but then you won't be able to set breakpoints and stuff).
Upvotes: 3