//读取 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(); }