读写2进制流文件//读写2进制流文件
读写2进制流文件
#include <fstream.h>
读写2进制流文件#include 
<iostream.h>
读写2进制流文件#include 
<stdlib.h>
读写2进制流文件
读写2进制流文件
void main()
{
读写2进制流文件    ofstream f1(
"wr1.dat");
读写2进制流文件    
if(!f1)
{
读写2进制流文件        cerr
<<"wr1.dat file not open!"<<endl;
读写2进制流文件        exit(
1);
读写2进制流文件    }

读写2进制流文件    
//f1.seekp(beg);
读写2进制流文件
    for(int i=0;i<21;i++)
读写2进制流文件        f1
<<i<<" ";
读写2进制流文件    f1.close();
读写2进制流文件
读写2进制流文件    ifstream f2(
"wr1.dat",ios::in|ios::nocreate);
读写2进制流文件    
if(!f1)
{
读写2进制流文件        cerr
<<"wr1.dat file not open!"<<endl;
读写2进制流文件        exit(
1);
读写2进制流文件    }

读写2进制流文件    
int x;
读写2进制流文件    
while(f2>>x)
读写2进制流文件        cout
<<x<<' ';
读写2进制流文件    cout
<<endl;
读写2进制流文件    f2.close();
读写2进制流文件}
    
读写2进制流文件

相关文章:

  • 2021-09-16
  • 2021-10-06
  • 2021-12-01
  • 2021-11-02
  • 2022-02-16
  • 2022-02-04
  • 2021-07-21
猜你喜欢
  • 2021-09-09
  • 2022-12-23
  • 2021-09-30
  • 2022-12-23
  • 2022-01-29
  • 2021-08-19
  • 2021-11-18
相关资源
相似解决方案