debugerror.cpp

来自「RFID温度签的源码」· C++ 代码 · 共 50 行

CPP
50
字号
#include "stdafx.h"

#include "DebugError.h"

#ifdef __DEBUG__

#include <stdio.h>
#include <string.h>
#include <time.h>

void OutputLogToFile( const char* str )
{
	if( str )
	{
		FILE* pFile = fopen( DEBUG_LOG_FILE, "a" );
		if( pFile )
		{
			fprintf( pFile, "\0\r" );
			fprintf( pFile, str );
			fclose( pFile );
		}
	}
}

void OutputLogToFile1( const char* str, int val )
{
	if( str )
	{
		int nlength = (int)strlen( str );
		char *p = new char[nlength + 32];
		sprintf( p, str, val );
		OutputLogToFile( p );
		delete p;
	}
}

void OutputTimeToFile()
{
	//char ch[128];
	//struct tm *newtime;
	//time_t aclock;
	//time( &aclock );
	//newtime = localtime( &aclock );
	//sprintf( ch, "Time:%-2d.%-2d:%-2d:%-2d\t", newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec );
	//OutputDebugLog( ch );
}

#endif // __DEBUG__

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?