-
Terminating a program
I'm writing a program and I'm having problems getting it the program to close when a certain event happens. The problem is because most sections of my code are within void functions, including the section involving termination of the program. I know return terminates a function but that only closes the program if its used it main.
My question is simply this. How would I get a program to close out when a certain event (that is defined in a void) happens?
-
Code:
#include <cstdlib>
// then later, inside some function
exit( EXIT_FAILURE );