home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / IO / FCLOSEAL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  417 b   |  20 lines

  1. /* fcloseal.c (emx+gcc) -- Copyright (c) 1990-1993 by Eberhard Mattes */
  2.  
  3. #include <sys/emx.h>
  4. #include <stdio.h>
  5.  
  6. int fcloseall (void)
  7. {
  8.   int i, n;
  9.   char ok;
  10.  
  11.   n = 0; ok = 1;
  12.   for (i = 3; i < _nfiles; ++i)             /* keep stdin, stdout, stderr */
  13.     if (_streamv[i].flags & _IOOPEN)
  14.       if (fclose (&_streamv[i]) == 0)
  15.         ++n;
  16.       else
  17.         ok = 0;
  18.   return (ok ? n : EOF);
  19. }
  20.