home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_12 / 9n12107b < prev    next >
Text File  |  1991-10-30  |  514b  |  21 lines

  1. LISTING 7:
  2.  
  3. // open a file, read through it sequentially, updating each record.
  4.  
  5.   {
  6.      int i;
  7.      binaryfile x(64);  // file object
  8.      ...
  9.      x.fileopen (filename, Update);
  10.      ...
  11.      for (i = x.fileread (FirstRecord) ; i > 0 ;
  12.           i = x.fileread (NextRecord)) {
  13.      ...             // processing the record
  14.      x.filewrite();  // rewrite the modified record
  15.      ...
  16.      }
  17.      ...
  18.   }    // object x goes out of scope and is 
  19.        // automatically closed and destroyed
  20.  
  21.