C++写文件夹

Posted on 2020-04-22 16:01  yacbo  阅读(148)  评论(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();

 

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3