2020
10-07
10-07
C++ I/O文件读写操作的示例代码
IO:向设备输入数据和输出数据C++的IO流c++中,必须通过特定的已经定义好的类,来处理IO(输入输出)文件流:对文件进行读写操作头文件:类库:ifstream对文件输入(读文件)ofstream对文件输出(写文件)fstream对文件输入或输出//写文件#include<fstream>#include<iostream>#include<string>usingnamespacestd;intmain(){stringname;intage;ofstreamoutfile;//也可以使用fstream,但是fstream的默认打开方式不截断文...
继续阅读 >