EXH example

#include <iostream.h>

#include <windows.h>

 

int

main(int, char **)

{

    char *ptr = NULL;

    __try {

        *ptr = 'h';     //NPW, raises exception (access violation)

        cerr << "Got to line after the invalid assignment\n";

    }

    __except(EXCEPTION_EXECUTE_HANDLER) {   //EXH: handling the exception

        cerr << "Handler is being run\n";

    }

    cerr << "About to exit main()\n";

    return(0);

}

(C) Copyright IBM Corporation 1992, 2010.