生成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;
}

posted @ 2022-08-12 09:43  江南王小帅  阅读(199)  评论(0)    收藏  举报