00001
00002
00003
00004
00005 #ifndef __DBGLOG_H_
00006 #define __DBGLOG_H_
00007
00008 #include <stdio.h>
00009 #include <stdarg.h>
00010 #include <string.h>
00011 #include <windows.h>
00012
00013 void dbglog ( char* szFormat ... )
00014 {
00015 va_list ap;
00016 char str [100000];
00017
00018 va_start ( ap, szFormat );
00019 vsprintf ( str, szFormat, ap );
00020 strcat (str, "\r\n");
00021 va_end (ap);
00022
00023 int file = _lopen ( DBGLOG_FILENAME, OF_WRITE );
00024
00025 if ( file == -1 )
00026 {
00027 file = _lcreat ( DBGLOG_FILENAME, 0 );
00028 }
00029
00030 _llseek ( file, 0, FILE_END );
00031 _lwrite ( file, str, lstrlen (str) );
00032 FlushFileBuffers ((HANDLE)file);
00033 _lclose ( file );
00034 }
00035
00036 void dbglog_eraselog ()
00037 {
00038 _lclose ( _lcreat ( DBGLOG_FILENAME, 0 ) );
00039 }
00040
00041 #endif