C Program Exits After Input

Sharky Forums


Results 1 to 4 of 4

Thread: C Program Exits After Input

  1. #1
    Reef Shark Squirlenutz's Avatar
    Join Date
    Mar 2003
    Posts
    492

    C Program Exits After Input

    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.
    System:
    Core 2 Duo e8400
    ASUS P5Q Pro
    4 gigs DDR2 PC2 8500 Mushkin Ram
    EVGA GTX 260
    WD 74 gig Raptor
    Maxtor 300 gig Diamond Max
    Maxtor 1 tb
    Antec NeoPower 550w

  2. #2
    NullPointerException rock's Avatar
    Join Date
    Sep 2000
    Location
    York, PA
    Posts
    6,203
    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.

    Open Source is free like a puppy is free.

    It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames.

    Understanding Evolution

  3. #3
    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.
    Spoiler

  4. #4
    Reef Shark Squirlenutz's Avatar
    Join Date
    Mar 2003
    Posts
    492
    sweet, got it working under dev++, thanks a bunch

    edit: for visual studios, it's not letting me debug the .c file
    Last edited by Squirlenutz; 01-30-2007 at 02:16 PM.
    System:
    Core 2 Duo e8400
    ASUS P5Q Pro
    4 gigs DDR2 PC2 8500 Mushkin Ram
    EVGA GTX 260
    WD 74 gig Raptor
    Maxtor 300 gig Diamond Max
    Maxtor 1 tb
    Antec NeoPower 550w

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •