ok guys, im trying to error proof my sys 32 program, and i want to build a function i can call that, will end the program and i dont want to have main end it, is there any command i can use to "kill the program"?
ok guys, im trying to error proof my sys 32 program, and i want to build a function i can call that, will end the program and i dont want to have main end it, is there any command i can use to "kill the program"?
The exit function terminates the program.
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
How about exit():
The process performs standard cleanup and then terminates. Before the cleanup is done any function registered by atexit is called. The cleanup consists on flushing all buffers and close any open files.Code:#include <iostream> using namespace std; void someFunc() { cout<<"program terminated\n"; exit(0); } int main () { someFunc(); cout<<"next line is main() return statement"<<endl; return 0; } output: program terminated Press any key to continue
http://www.cplusplus.com/ref/
Last edited by 7stud; 03-15-2005 at 02:37 PM.
alright thanks guys, i was using exit wrong lol, i just put "exit;" but yeah that function fixed it thanks