读写二进制流文件
//读写2进制流文件
#include
#include
#include
void main()
{
ofstream f1("wr1.dat");
if(!f1)
{
cerr<<"wr1.dat file not open!"< exit(1); } //f1.seekp(beg); for(int i=0;i<21;i++) f1<
f1.close(); ifstream f2("wr1.dat",ios::in|ios::nocreate); if(!f1) { cerr<<"wr1.dat file not open!"< exit(1); } int x; while(f2>>x) cout< cout< f2.close(); }
- 上一篇:c++ 中创建动态二维数组
- 下一篇:c++文件拷贝





