#include#include #include int main() { // 向文件里写数据 std::ofstream os; //创建一个文件输出流对象 // os.open("../books.txt", std::fstream::out|std::fstream::app);//将对象与文件关联, app就是每次在文件后面继续添加内容 os.open("../test.txt", std::fstream::out);//将对象与文件关联 for(int i=0; i < 10; i ++) { std::string str = "hello worldn"; os< std::cout << line << std::endl; } return 0; }



