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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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