c++ 一日一练:利用文件流缓冲区

// open and close a file using buffer members
#include <fstream>
using namespace std;

int main () {
  char ch;
  fstream filestr;
  filebuf *pbuf;

  pbuf=filestr.rdbuf();
  
  pbuf->open ("test.txt", fstream::in | fstream::out);

  // >> i/o operations here <<

  pbuf->close();

  return 0;
}

重要指示:

      把文件打开到缓冲区中。。。过程如下:

 

      文件-------》缓冲区-------》流

你可能感兴趣的:(C++,c,C#)