⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 log.cpp

📁 一个和TOP程序差不多功能的程序
💻 CPP
字号:
#include "Log.hpp"
#include <string.h>

LogFile::LogFile(char *File)
{
	int len=strlen(File);
	memcpy(FileName,File,len>255?255:len);
	fp=fopen(FileName,"rw+");
}
LogFile::~LogFile()
{
	fclose(fp);
}
void LogFile::Printf(const char * Format,...)
{
}

/*****************************************************/

Config::Config(char *File)
{
	int len=strlen(File);
	memset(FileName,0,255);
	memcpy(FileName,File,len>255?255:len);
	fp=fopen(FileName,"r");
	memset(NeName,0,sizeof(NeName));
	memset(FilePath,0,sizeof(FilePath));
}
Config::~Config()
{
}

int Config::ReadFileConfig()
{
	if(!fp)
		return 0;
	char buf[1024];
	fread(buf,1,sizeof(buf),fp);
	char *lpBuf=strstr(buf,"[NE CONFIG]");
	if(!lpBuf)
	{
		printf("Configuration file is corrupted, please re-establish");
		return 0;
	}
	lpBuf=strstr(lpBuf,"NENAME");
	if(lpBuf)
	{
		sscanf(lpBuf,"NENAME=%64[^#]",NeName);
	}
	lpBuf=strstr(lpBuf,"NEID");
	if(lpBuf)
	{
		sscanf(lpBuf,"NEID=%d",&NeID);
	}
	lpBuf=strstr(lpBuf,"FS");
	if(lpBuf)
	{
		sscanf(lpBuf,"FS=%255[^#]",FilePath);
	}
	lpBuf=strstr(lpBuf,"INTERVAL");
	if(lpBuf)
	{
		sscanf(lpBuf,"INTERVAL=%d",&InterVal);
	}
	lpBuf=strstr(lpBuf,"DBNAME");
	if(lpBuf)
	{
		sscanf(lpBuf,"DBNAME=%20[^#]",DbName);
	}
	fclose(fp);
	return 0;
}
int Config::SetFileName(char * File)
{
	int len=strlen(File);
	memset(FileName,0,255);
	memcpy(FileName,File,len>255?255:len);
	fp=fopen(FileName,"r+");
	return fp?0:-1;
}

⌨️ 快捷键说明

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