home *** CD-ROM | disk | FTP | other *** search
/ Using Visual C++ 4 (Special Edition) / Using_Visual_C_4_Special_Edition_QUE_1996.iso / ch16 / myerror.cpp < prev    next >
C/C++ Source or Header  |  1995-11-13  |  884b  |  36 lines

  1. #include "myerror.h"
  2.  
  3. CMyErrorClass :: Init()
  4. {
  5.     char key[KEY_SIZE];
  6.     CString description;
  7.  
  8.     sprintf(key,"%d",_HEAPBADBEGIN);
  9.     description.LoadString(IDS_HEADBADBEGIN); 
  10.     err_msg[key] = description;
  11.     sprintf(key,"%d",_HEAPBADNODE);
  12.     description.LoadString(IDS_HEAPBADNODE);
  13.     err_msg[key] = description;
  14.     sprintf(key,"%d",_HEAPBADPTR);
  15.     description.LoadString(IDS_HEAPBADPTR);
  16.     err_msg[key] = description;
  17.     sprintf(key,"%d",_HEAPEMPTY);
  18.     description.LoadString(IDS_HEAPEMPTY);
  19.     err_msg[key] = description;
  20.     sprintf(key,"%d",_HEAPOK);
  21.     description.LoadString(IDS_HEAPOK);
  22.     err_msg[key] = description;
  23. }
  24.  
  25.  
  26. CMyErrorClass::display( int index )
  27. {
  28.     char key[KEY_SIZE];
  29.     sprintf(key,index);
  30.     CString message;
  31.     if ( err_msg.Lookup( key, message ) )
  32.         TRACE("Error message is : %s", (const char *) message);
  33.     else
  34.         TRACE1("No Error message for %d",index);
  35. }
  36.