Export (0) Print
Expand All
div
Expand Minimize
2 out of 5 rated this helpful - Rate this topic

fclose, _fcloseall

Closes a stream (fclose) or closes all open streams (_fcloseall).

int fclose( 
   FILE *stream 
);
int _fcloseall( void );

Parameter

stream
Pointer to FILE structure.

Return Value

fclose returns 0 if the stream is successfully closed. _fcloseall returns the total number of streams closed. Both functions return EOF to indicate an error.

Remarks

The fclose function closes stream. _fcloseall closes all open streams except stdin, stdout, stderr (and, in MS-DOS, _stdaux and _stdprn). It also closes and deletes any temporary files created by tmpfile. In both functions, all buffers associated with the stream are flushed prior to closing. System-allocated buffers are released when the stream is closed. Buffers assigned by the user with setbuf and setvbuf are not automatically released.

Requirements

Function Required header Compatibility
fclose <stdio.h> ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP
_fcloseall <stdio.h> ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.

Libraries

All versions of the C run-time libraries.

Example

See the example for fopen.

See Also

Stream I/O Routines | _close | _fdopen | fflush | fopen | freopen | Run-Time Routines and .NET Framework Equivalents

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.