RAD Studio |  |

_fcloseall

Header File

stdio.h

Category

Input/output Routines

Prototype

int _fcloseall(void);

Description

Closes open streams.

_fcloseall closes all open streams except

stdauxstdstreams

When _fcloseall flushes the associated buffers before closing a stream. The buffers allocated by the system are released.

Note: stdprn and stdaux streams are not available in Win32.
Return Value

_fcloseall returns the total number of streams it closed. The _fcloseall function returns EOF if any errors were detected.

Example

Copy Code

    #include <stdio.h>
    int main(void)
    {
       int streams_closed;
       /* open two streams */
       fopen("DUMMY.ONE", "w");
       fopen("DUMMY.TWO", "w");
       /* close the open streams */
       streams_closed = fcloseall();
       if (streams_closed == EOF)
          /* issue an error message */
          perror("Error");
       else
          /* print result of fcloseall() function */
          printf("%d streams were closed.\n", streams_closed);
       return 0;
    }

Portability

POSIX | Win32 | ANSI C | ANSI C++
| + |  |

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!