home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 1.ddi / CLIBSRC.ZIP / XFCLOSE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1008 b   |  43 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - xfclose.c
  3.  *
  4.  * function(s)
  5.  *        _xfclose - closes streams
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #include <stdio.h>
  18. #include <RtlData.h>
  19.  
  20. /*---------------------------------------------------------------------*
  21.  
  22. Name            _xfclose - closes streams
  23.  
  24. Usage           void _xfclose(void)
  25.  
  26. Description     called at exit to close open streams
  27.  
  28. *---------------------------------------------------------------------*/
  29. void _FARFUNC _xfclose( void )
  30.   {
  31.   register FILE *fp;
  32.   register int  i;
  33.   _QRTLDataBlock;
  34.  
  35.   for( i = 0, fp = _QRTLInstanceData(_streams);
  36.        i < _QRTLInstanceData(_nfile);
  37.        fp++, i++ )
  38.     {
  39.     if( fp->flags & _F_RDWR )
  40.         fclose( fp );
  41.     }
  42.   }
  43.