_flushall对所有已经打开的流flush

Run-Time   Library   Reference      
  _flushall  
   
  Flushes   all   streams;   clears   all   buffers.  
   
  int   _flushall(   void   );  
   
  Return   Value  
   
  _flushall   returns   the   number   of   open   streams   (input   and   output).   There   is   no   error   return.  
  Remarks  
   
  By   default,   the   _flushall   function   writes   to   appropriate   files   the   contents   of   all   buffers   associated   with   open   output   streams.   All   buffers   associated   with   open   input   streams   are   cleared   of   their   current   contents.   (These   buffers   are   normally   maintained   by   the   operating   system,   which   determines   the   optimal   time   to   write   the   data   automatically   to   disk:   when   a   buffer   is   full,   when   a   stream   is   closed,   or   when   a   program   terminates   normally   without   closing   streams.)  
   
  If   a   read   follows   a   call   to   _flushall,   new   data   is   read   from   the   input   files   into   the   buffers.   All   streams   remain   open   after   the   call   to   _flushall.  
   
  The   commit-to-disk   feature   of   the   run-time   library   lets   you   ensure   that   critical   data   is   written   directly   to   disk   rather   than   to   the   operating   system   buffers.   Without   rewriting   an   existing   program,   you   can   enable   this   feature   by   linking   the   program's   object   files   with   COMMODE.OBJ.   In   the   resulting   executable   file,   calls   to   _flushall   write   the   contents   of   all   buffers   to   disk.   Only   _flushall   and   fflush   are   affected   by   COMMODE.OBJ.  
   
  For   information   about   controlling   the   commit-to-disk   feature,   see   Stream   I/O,   fopen,   and   _fdopen.  
  Requirements  
  Function   Required   header   Compatibility  
  _flushall   <stdio.h>   Win   98,   Win   Me,   Win   NT,   Win   2000,   Win   XP  
   
  For   additional   compatibility   information,   see   Compatibility   in   the   Introduction.  
   
  Libraries  
   
  All   versions   of   the   C   run-time   libraries.  
  Example  
   
  //   crt_flushall.c  
  /*   This   program   uses   _flushall  
    *   to   flush   all   open   buffers.  
    */  
   
  #include   <stdio.h>  
   
  int   main(   void   )  
  {  
        int   numflushed;  
   
        numflushed   =   _flushall();  
        printf(   "There   were   %d   streams   flushed/n",   numflushed   );  
  }  
   
  Output  
   
  There   were   3   streams   flushed

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值