# include iostream # includefstreamusingnamespacestd; int main () { char buf[32]='helloworld '; ofstreamofs(sad.txt ); //创建输出流对象if (! OFS//如果此文件没有错误{ cout'open failure'endl; } ofsbuf; //buf将数组的内容保存在此文件中,格式为ofs.close (; //文件关闭return 0打开//ofstream文件并将内容写入文件。 对于程序来说,是输出到文件//打开//ifstream文件,从文件中读取东西并写入程序。 对于程序来说是输入