Dev C++

This is a discussion on Dev C++ within the C++ Programming forums, part of the General Programming Boards category; I am a new user to Dev C++ and I was compiling and executing my programs and as soon as ...

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    4

    Question Dev C++

    I am a new user to Dev C++ and I was compiling and executing my programs and as soon as I put in the last input, my dos window gives an answer and closes automatically. How do you keep that window open?

  2. #2
    Registered User OxYgEn-22's Avatar
    Join Date
    Apr 2002
    Posts
    36
    I never found a good way to do this.. but, i juse used a getch() to stop it at the end of execution
    Is that air you're breathing?

  3. #3
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    Use getch() before your main returns. I don't use DevC++ but from previous posts I understand that getch() will work with it. Just make sure that you include conio.h (it may be conio.c with DevC++).

    Basically a stripped down main with getch() would look like this:

    Code:
    #include "conio.h" //like I said you may need to use conio.c
    
    int main()
    {
      printf("Hello World!");
      getch();
      return(0);
    }

  4. #4
    Registered User Mario's Avatar
    Join Date
    May 2002
    Posts
    317
    Another possibility is:

    Code:
    #include <stdlib.h>
    
    int main()
    {
        /*... do whatever you want to do ...*/
        system("PAUSE"); //the program will wait for your input to close
        return 0;
    }
    Regards,
    Mario Figueiredo
    Using Borland C++ Builder 5

    Read the Tao of Programming
    This advise was brought to you by the Comitee for a Service Packless World

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  2. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM
  3. openGL programming - From MSVC++ to Dev C++
    By WDT in forum Game Programming
    Replies: 3
    Last Post: 03-08-2004, 08:47 PM
  4. openGL programming - From MSVC++ to Dev C++
    By WDT in forum Game Programming
    Replies: 1
    Last Post: 03-08-2004, 05:19 PM
  5. DEV C++ Limitations?
    By Kirdra in forum Game Programming
    Replies: 3
    Last Post: 09-09-2002, 10:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21