Original Post
I just made a program to test what happened if I tried to open a file that didnt exist. In my OpenFile function I test if the file exist and if it doesnt it gives an error message and the program should shut down. I call this OpenFile function in another function which is in my main loop.
After the OpenFile function call I have another function called WriteChar and that function would only work if the file had been opened which it is not. But the program doesnt shut down emmidiately. Once the shutdown function have run it ofcourse return to the function where OpenFile was called and that way WriteChar is also run.
What I want the program to do is that when an error occurs it emmidiately shuts donw happens making sure nothing more in the program is run.
One way I guess is to have every function give a return value which is checked and but I dont like that.
Is there a way?