//读取 void read_file(const char *fn, string& content) { std::ifstream in(fn); std::ostringstream tmp; tmp << in.rdbuf(); content = tmp.str(); } //写入 void write_file(const char *fn, string& content) { std::ofstream fout(fn, std::ios::out); fout<<content; fout.close(); }
C++ 读取文件数据和输出数据到文件
诸位正值青春年少,一定恣情放纵,贪恋香艳梅施之情,喜欢风流雅韵之事,洒脱木拘。然而诸位可知,草上露一碰即落,竹上霜一触即溶,此种风情难于长久。