生成log
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
string logSave;
void LogWrite(string Mesg) {
ofstream write;
write.open(logSave.c_str(), ios::out);
write.write(Mesg.c_str(), Mesg.length());
write.flush();
write.close();
}
int main() {
logSave = ".\\templog.txt";
string Barcode, Mac, Mac1;
while (true)
{
cout << endl;
cout << "请输入Barcode:";
cin >> Barcode;
cout << endl << endl;
string LogW = Barcode + "|";//转档文件
cout << LogW << endl;
cout << "请输入Mac1:";
cin >> Mac;
cout << endl << endl;
LogW += Mac + "|";
cout << LogW << endl;
LogW += "PASS|";
cout << LogW << endl;
LogWrite(LogW);
}
return 0;
}

浙公网安备 33010602011771号