Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - fflush http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   fflush

   Usage
   #include <stdio.h>
   int fflush(FILE *fp);

   Description
   Flushes  the buffer associated with stream fp. If the file  is  opened
   for writing, the buffer is written. If the file is opened for reading,
   the buffer is cleared.

   The  fflush function may be used to force the data in the file  buffer
   to  be written to the file before the buffer becomes  full.  Similarly
   data  read  from a file is input a buffer full at a time.  Only  after
   every character has been processed does another file access occur. The
   fflush  function  may be used to clear the buffer and thus  force  the
   next read operation to occur.

   Example
   #include <stdio.h>
   FILE *fp;
   main()
   {
        if(!(fp = fopen("file.dat","w")))
             return;
        fflush(fp);    /* flush buffer to disk to protect */
                       /* data before performing operations */
                       /* that may cause system crash */
   }

   Return Value
   fflush  returns  a 0 if the buffer was successfully  flushed.  EOF  is
   returned if an error occurred.


See Also: fclose flushall

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