Initial Code v0.1.0

This commit is contained in:
jomjol
2020-08-07 17:42:29 +02:00
parent 0e2475bf0d
commit 4fe26dc0d8
269 changed files with 87264 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
#include "ClassLogFile.h"
#include "time_sntp.h"
ClassLogFile LogFile("/sdcard/log.txt");
void ClassLogFile::WriteToFile(std::string info, bool _time)
{
FILE* pFile;
std::string zwtime;
pFile = fopen(logfile.c_str(), "a+");
if (_time)
{
time_t rawtime;
struct tm* timeinfo;
char buffer[80];
time(&rawtime);
timeinfo = localtime(&rawtime);
strftime(buffer, 80, "%Y-%m-%d_%H-%M-%S", timeinfo);
zwtime = std::string(buffer);
info = zwtime + ": " + info;
}
fputs(info.c_str(), pFile);
fputs("\n", pFile);
fclose(pFile);
}
ClassLogFile::ClassLogFile(std::string _logfile)
{
logfile = _logfile;
}
ClassLogFile::~ClassLogFile()
{
}

View File

@@ -0,0 +1,17 @@
#include <string>
class ClassLogFile
{
private:
/* data */
std::string logfile;
public:
ClassLogFile(std::string _logfile);
~ClassLogFile();
void WriteToFile(std::string info, bool _time = true);
};
extern ClassLogFile LogFile;