Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

MyHandleError

The MyHandleError function is an example of a tool function used to print an error message and exit the calling program. The examples for several CryptoAPI functions in Cryptography Reference and the more extended examples in Using Cryptography implement this function. Real applications may require more complex error handling capability.


#include <stdio.h>
#include <tchar.h>
#include <windows.h>

void MyHandleError(LPTSTR psz)
{
    _ftprintf(stderr, TEXT("An error occurred in the program. \n"));
    _ftprintf(stderr, TEXT("%s\n"), psz);
    _ftprintf(stderr, TEXT("Error number %x.\n"), GetLastError());
    _ftprintf(stderr, TEXT("Program terminating. \n"));
    exit(1);
} // End of MyHandleError



 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.