fcloseall() Close All Open Streams
#include <stdio.h>
int fcloseall(void);
fcloseall() closes all open streams except 'stdin', 'stdout',
'stderr', 'stdaux', and 'stdprn'. All buffers associated with the
streams are flushed before being closed. System-allocated buffers
are freed when the stream is closed.
Returns: The total number of streams successfully closed. EOF is
returned on error.
Notes: Buffers assigned by setbuf() are not automatically freed.
-------------------------------- Example ---------------------------------
This example opens two streams and closes them both with a single
call to fcloseall().
#include <stdio.h>
FILE *stream1, *stream2;
main()
{
if ((stream1 = fopen("ch1.txt","r+")) != NULL &&
(stream2 = fopen("ch2.txt","r+")) != NULL)
.
.
.
fcloseall();
}
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster