https://cplusplus.com/doc/tutorial/files/ ofstream: Stream class to write on files,如写文件时需要附加而不是覆盖原文件内容,可 std::ofstream outfile; outfile.open("test.txt", std::ios_base::app); // append instead of overwrite ifstream: Stream class to read from filesfstream: Stream class to both read and write from/to files.