C++写文件夹

Posted on 2020-04-22 16:01  yacbo  阅读(145)  评论(0编辑  收藏  举报

写文件

#include <fstream>
using namespace std;
int main() {
  ofstream outFile;
  outFile.open("D:\\gaoyu.txt");
  outFile << "this is a c++ file write test.";
  outFile.close();
  return 0;
}

 

ofstream ofs(path + "/result.txt", ios::out | ios_base::binary);
string line2 = "";
line2.append("\t阈值    ").append("\ttpr(1-frr)    ").append("\tfpr(far)    ").append("\t准确率\n");
ofs.write(line2.data(), line2.length());
ofs.flush();
ofs.close();

 

Copyright © 2024 yacbo
Powered by .NET 8.0 on Kubernetes