_fcloseall

From RAD Studio
Jump to: navigation, search

Go Up to stdio.h Index


Header File

stdio.h

Category

Input/output Routines

Prototype

int _fcloseall(void);

Description

Closes open streams.

_fcloseall closes all open streams except

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

#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++

+