home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_06 / 8n06077a < prev    next >
Text File  |  1990-05-02  |  894b  |  31 lines

  1. *****Listing 9*****
  2.  
  3.     Text File:
  4.  
  5.         TOOBIG  Value cannot be larger then %d
  6.         BADNAME The name %s is not defined
  7.         PUNT    Unknown error, aborting
  8.  
  9.     Sample output of special program:
  10.  
  11.         header1:
  12.                 enum errkind { TOOBIG, BADNAME, PUNT };
  13.         header2:
  14.                 char *errstring[] = {
  15.                         "Value cannot be larger then %d",
  16.                         "The name %s is not defined",
  17.                         "Unknown error, aborting",
  18.                         };
  19.  
  20.     Sample Usage:
  21.  
  22.                                      /* ANSI prototype */
  23.         extern void error(enum errkind, char*);
  24.         error(TOOBIG, (char*)MAX);
  25.         error(BADNAME, str);
  26.         error(PUNT, 0); /* the 0 is ignored in this case */
  27.  
  28.     The error() function is a small printf-like function
  29.     which is very easy to write.
  30.  
  31.