#include <iostream>
#include <fstream>
class PrintInfo
{
public:
PrintInfo(const char *i_Path);
~PrintInfo();
void GetInfo(const char *i_Info);
void ExcutPrint();
void EndPrint();
private:
std::ofstream m_outInfo;
std::string m_Path;
std::string m_Info;
};
#include "PrintInfo.h"
using namespace std;
PrintInfo::PrintInfo(const char *i_Path)
{
m_Path = i_Path;
m_outInfo.open(m_Path,ios::app|ios::in);
}
PrintInfo::~PrintInfo()
{
m_outInfo.close();
}
void PrintInfo::GetInfo(const char *i_Info)
{
m_Info = i_Info;
}
void PrintInfo::ExcutPrint()
{
m_outInfo << m_Info.c_str();
m_outInfo << "\n";
}
void PrintInfo::EndPrint()
{
m_outInfo.close();
}
C++ txt文件输出
最新推荐文章于 2023-01-12 22:38:55 发布