写文件
#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();