Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Pascal - <b> flush write file buffers to disk pp 96</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FLUSH                    Write File Buffers to Disk                  pp 96

 Syntax:  Flush (FileVar) ;

 Type:    File

 Form:    Procedure

 Purpose: Empty the internal sector bufffer associated with FileVar.

 Notes:   This assures that the sector buffer is written to disk if any
          write operations have taken place since the last physical write
          to disk.  This also insures that the next read operation will
          perform a physical read of the disk.
          Flush does not apply to text files.

 ----------------------------------------------------------------------------



 Usage:
       CONST
          FileName : String [8] = 'Name.Ext'   ; { Constant file name }
       TYPE
          CheckNumber = 1..10000               ; { Check number type }
          CheckDate   = String [9]             ; { DDMMMYYYY             }
          PayeeType   = String [80]            ; { Payee type            }
          Check       = Record
                        CheckNum : CheckNumber ; { Check number field    }
                        Amount   : Real        ; { Amount field          }
                        Date     : CheckDate   ; { Date field            }
                        Payee    : PayeeType   ; { Payee field           }
                        End                    ; { End of record         }
       VAR
          FileVar     : File of Check          ; { 80 byte record type   }
          ThisCheck   : Check                  ; { Individual check type }

       BEGIN
          Assign (FileVar,FileName)            ; { Assign name to handle }
          Reset  (FileVar)                     ; { Open file handle      }
          Write  (FileVar, ThisCheck)          ; { Write a record        }
          Flush  (FileVar)                     ; { Force a disk write    }
          Close  (FileVar)                     ; { Close the handle      }
       END.

See Also: Read ReadLn Write WriteLn

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson