头文件:#include<fstream> /*打开配置文件*/ ofstream out("input.txt"); if(!out.is_open()){ #if DEBUG cout<<"打开配置文件失败(写入):"<<endl; #endif return -2; } /*写入配置文件*/ out <<"写入文件的数据"; out.close();