Thread: Exe closing too fast after completion

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    2

    Exe closing too fast after completion

    Im just now starting into C++ and after trying out the code in the tutorials, compiling, and running the exe, it works fine until it the program is done. It just shuts down without letting me read the output. I think I remember a fix for this in a magazine somewhere, but I can't remember where. Any help would be appriciated.

    Im running Windows 98SE.

  2. #2
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    read the FAQ of this site
    hello, internet!

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    2
    Is there a way to do it besides having to press enter?

  4. #4
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Code:
    #include <conio.h>
    (whatever other includes)
    
    int main
    {
      ...
      ...
      getch();
      return 0;
    }
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  5. #5
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    What XSquared said will work, but it depends on your compiler. Conio.h is non-standard. Take moi's original advice and read the FAQ. It provides several solutions and explains the pros/cons of each.

  6. #6
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    Use the command prompt.
    Last edited by Shadow; 09-02-2002 at 08:54 PM.
    The world is waiting. I must leave you now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  2. how to monitor exe and dll interactions?
    By George2 in forum C Programming
    Replies: 1
    Last Post: 10-26-2007, 04:22 AM
  3. I/O Completion Port and Queue Status :: Winsock
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 11-02-2002, 01:00 PM
  4. Overlapped I/O and Completion Port :: Winsock
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 10-30-2002, 05:14 PM
  5. Replies: 2
    Last Post: 10-29-2002, 04:56 PM