Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I try to handle a issues inside one function. I dont know what error will come there. But want to handle all the error occurs inside that function. I put try catch. But still my application is crushed. Thank you.
On WinCE

What I have tried:

So I tried a simple code
try{
		
		int n=5,n1=0;
		bool test= true;
		if(test)
		{
			n=n/n1;
		}
	}
	catch(const char* msg){		
		
	}
Posted
Updated 9-Jan-18 22:17pm

1 solution

See for instance here: c++ - Catching exception: divide by zero - Stack Overflow[^].

Please note, even if floating exception would have been catchable, your code would not correctly handle it, because exceptionare caught based on their type.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900