home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / cprog / btree.zip / RUNERR.HPP < prev    next >
C/C++ Source or Header  |  1992-02-16  |  1KB  |  65 lines

  1.  
  2.  
  3. //    C++ Runtime Error Logging
  4. //    (c) 1990,1991 Larry A. Walker
  5. //    This source is proprietary information which cannot be distributed 
  6. //    without written permission of Larry A. Walker
  7.  
  8. #ifndef RUNERR_H
  9. #define RUNERR_H
  10.  
  11.             // Define one of these three:
  12. /*
  13. #define UNIX
  14. #define XENIX
  15. */
  16. #define MSDOS
  17.  
  18. /* The error handler is the basic class for all error calls */
  19.  
  20. #define LOGGING        1
  21. #define NOLOG        0
  22. #define PRINTERRORS     1
  23. #define NOPRINTERRORS    0
  24. #define WARNING        -1
  25. #define FATAL        -2
  26. #ifndef ON        
  27. #define ON    1
  28. #endif
  29. #ifndef OFF        
  30. #define OFF    0
  31. #endif
  32.  
  33.  
  34. #include <stdio.h>
  35.  
  36. class RunError {
  37.  
  38.     FILE *    log_fd;          // log file destination, NULL = none
  39.  
  40.     int     display_errors_ ;    // display errors 1 = true, 0 = false
  41.     FILE *    display_dest_;        // display destination, stdout stderr
  42.  
  43.     int    fatal_;            // processing a fatal error 0 = no, 
  44.                     // 1 = yes
  45.  
  46.     public:
  47.  
  48.         // log errors, display errors
  49.     RunError();
  50.     
  51.     ~RunError(){
  52.         if(log_fd != NULL)
  53.             fclose(log_fd);
  54.     }
  55.  
  56.     void set_display ( int , FILE *);    // on/off, destination
  57.  
  58.     void set_log ( int, char * , int );     // log name, append yes/no
  59.     
  60.     void proc_error (int, int, char *, char *, int); 
  61.  
  62. };
  63.  
  64. #endif RUNERR_H
  65.