47.structured Exception Handling – Windows System Programming In C/c++

Are the important functions get exception code get exception information debug great rage exception at normal termination which generally this function we are using in finally block so if you see so it indicate whether the try block of a.

Termination handler terminate normally or abnormally so the return value if you see abnormally the return value is non and it terminate normally the return value is zero there is a.

Great exception code here the return type of that function is in a divot type and these are the possible return error code so here I am going to be use this one exception in 2/0 if you see the gate exception information I use in this I use this function.

In program so the return type.

Is the long pointer exception and it contains the two things exception record and context so if you.

See that exception record here exonic.

Exception pointer yours so except some record and context record so this one is the exception record a structure see it contains the various things record address and all these things and this one is the contest basically it contains.

The processor a specific register of data and there is a one debug gate function if you want to debug your program through through programming then you can use this function and you can debug your code very successfully if you want to reject section then you can use that raise an exception in the column trend will see and do not forget to read this example of exceptional handler they have beautifully explained here so now move to the.

Coding part here I have written one separate program of the tie accept so here I am taking the two.

Very three variables a b c and basically this program is divided by 0 so what will happen.

In this case it will come here and it will search this error code if there are code is found exception in divided by 0 it will execute this handler so just to build this code once and we’ll see so suppose here I am fighting 10/0 so what will happen in this case exception God and this program is why I.

Have used that because if I’m not writing then what will happen in this case see.

There is a one error so CRT secured no warning because a scanf is always.

Not safe so that’s why I have to write other example I’m going to be used on this things.

Be used here it is n by zero how this is worm is going to be done late normally.

Or at normally busy so there is one function here exceptional exception handler function it contains the two argument first one is the error.

Code and extraction point we have already seen so the exception code written the error code value here and accept some information will return something we’ll see here so suppose here I am writing on the statement here first printf the exceptional handler function now here I am writing if this error code.

OD is equal to exception in divide by zero so what will happen in this case I am writing one a statement and this.

One is the expected then it will return then else case what.

Will happen just copy this two line here and here i am writing unexpected if something goes wrong so to continue then search now in try in try block in nested try here I’m dividing a by B direct pasted here and right here plaintiff and that normal termination termination otherwise it will terminate normally so right here else case this one is the normal termination so.

Just try to build this code will succeeded and I’m backing your pain and zero so if you see in try block in exceptional handler function first the exception is already caught then got access violation as expected in finally block there is a abnormal termination and then last one is the exception god so this one was the basic program of a.

Exit smell handling hope you liked this video thanks for watching this video.

Do it comment share and subscribe this.