I am using a Graphics Library called Irrlicht at some point i have to write this code
if(!device){
//error code here`
}
i am not in the main function but want to close the application when this error happens please keep in mind that I am a beginner so this question might sound dumb i see some people do this:
int main(){
if(!device){
return 1;
}
return 0;
}
i am not in the main function and want to exit the application outside of the main function
The following example give you an idea about some of the possibilities.
You can simply copy and paste it and play around with it. Simply use only one line of the "termination actions" like
throworexit. If you don't have thetry catch blockin the main function, your application will also terminate because the exception will not be caught.