写日志函数c盘WriteLog

void WriteLog(char * szLog)
{
	SYSTEMTIME st;
	GetLocalTime(&st);
	FILE *fp;
	fp = fopen("c:\\log.txt", "at");
	fprintf(fp, "MyLogInfo: %d:%d:%d:%d ", st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
	fprintf(fp, szLog);
	fclose(fp);
	OutputDebugStringA(szLog);
}

void WriteLog(wchar_t * szLog)
{
	SYSTEMTIME st;
	GetLocalTime(&st);
	FILE *fp;
	fp = _wfopen(L"c:\\ribi.txt", L"at");
	//fwprintf(fp, L"MyLogInfo: %d:%d:%d:%d ", st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
	fwprintf(fp, szLog);
	fclose(fp);
	OutputDebugString(szLog);
}
	wchar_t ribi2[100];
swprintf(ribi2, L"扫描 找到端口 %d 已经打开", nowport);
	WriteLog(ribi2);

 

你可能感兴趣的:(自己写的函数全部集合)