Click to See Complete Forum and Search --> : C Program Exits After Input
Squirlenutz
01-30-2007, 12:39 AM
Currently I'm taking a C course, and I've got my program running perfectly under a unix platform, and my instructor has it to where we can recieve extra credit if we take screenshots of our program compiled under the windows platform. Well, after i compile it in windows, as soon as I enter the input, it exits the program. I remember there being a fix for it back when i took a basic programming class in high school. I've searched google for hours now with no success, and i couldn't find anything in my C book about it. Anyone know by chance? Thanks ahead of time.
Are you using Visual Studio? Console applications will run and then the window will close once it's complete if you execute with F5 (Debug -> Start). However, if you run with Ctrl-F5 (Debug -> Start Without Debugging) you'll get a nice "Press any key to continue" prompt keeping the window open.
Alternatively, you could open a command prompt, browse to the bin directory of the solution, and run it directly.
coop_2000
01-30-2007, 10:12 AM
or just add a blank line user input prompt at the end of your program so you have to hit a key before it exits.
Squirlenutz
01-30-2007, 12:44 PM
sweet, got it working under dev++, thanks a bunch
edit: for visual studios, it's not letting me debug the .c file