Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <windows.h>
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <time.h>
- //=============================================================================================================
- #define DbgMsg DbgWrite
- //=============================================================================================================
- void DbgWrite( const char *fmt, ... )
- {
- static bool bFirstTime = true;
- if( bFirstTime )
- {
- std::remove( "C:\\asd.txt" );
- bFirstTime = false;
- }
- time_t rawtime;
- time( &rawtime );
- struct tm *timeinfo = localtime( &rawtime );
- char szTime[64];
- strftime( szTime, sizeof(szTime) - 1, "[%H:%M:%S] ", timeinfo );
- va_list va_alist;
- char szBuffer[2048];
- va_start( va_alist, fmt );
- _vsnprintf_s( szBuffer, sizeof(szBuffer), sizeof(szBuffer) - 1, fmt, va_alist );
- va_end( va_alist );
- std::string buf( szBuffer );
- buf.insert( 0, szTime );
- OutputDebugStringA( buf.c_str() );
- std::ofstream f( "C:\\asd.txt", std::ios_base::out | std::ios_base::app );
- f << buf << std::endl;
- f.close();
- }
- //=============================================================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement