home *** CD-ROM | disk | FTP | other *** search
/ Large Pack of OldSkool DOS MOD Trackers / beaversweeper_v101.zip / src / tkerror.cpp < prev    next >
C/C++ Source or Header  |  2003-01-06  |  597b  |  34 lines

  1. #include <stdarg.h>
  2. #include <string.h>
  3. #include <stdio.h>
  4.  
  5. #include <windows.h>
  6.  
  7. static FILE *dbgfile=NULL;
  8.  
  9. void tdbg_open (char *fname)
  10. {
  11.     if (!dbgfile)
  12.         dbgfile = fopen (fname,"wt");
  13. }
  14. void tdbg_close ()
  15. {
  16.     if (dbgfile)
  17.         fclose (dbgfile);
  18. }
  19. void tdbg_printf (char *str, ...)
  20. {
  21.     va_list values;
  22.     char newstr[1024];
  23.     
  24.     va_start( values, str );
  25.     _vsnprintf( newstr, 1024,str, values);
  26.     va_end( values);
  27.  
  28.     if (dbgfile)
  29.     {
  30.         fprintf (dbgfile,newstr);
  31.         fflush(dbgfile);
  32.     }
  33.     OutputDebugString(newstr);
  34. }