Menu

Simple Question about running program

JQ
2010-12-08
2012-09-26
  • JQ

    JQ - 2010-12-08

    Hi, it maybe a stupid question but I'm trying to run a C program after
    compiling. After executing the program, the program exits out and I want to
    manually close the running window instead of exitting after the program ends.
    Does anyone know how to fix this? Thank you

     
  • Steve A

    Steve A - 2010-12-08

    I assume by your statement that you are running a console app under
    windows.
    You can do one of two things:
    1) open a DOS box and execute your program from the command line:
    a) click on START button,
    b) type CMD
    c) click OK
    d) manually change path to where your app resides.

    2) add a getch() statement to the bottom of your main() function, like this:

    int main()
    {
    blah...,
    blah...,
    blah.......,

    ch = getch();
    return 0;
    }

    Steve

     

Log in to post a comment.