原网址:http://blog.youkuaiyun.com/hgj125073/article/details/8287062
fclose()关闭关闭一个流,注意:使用fclose()函数就可以把缓冲区内最后剩余的数据输出到磁盘文件中,并释放文件指针和有关的缓冲区。
#include<stdio.h>
原型:
int fclose(FILE *stream);
int _fcloseall(void);
fclose returns 0 if the stream is successfully closed._fcloseall returns the total number of streams closed.
The _fcloseall function closes all open streams exceptstdin, 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.
如果流成功关闭,fclose 返回 0,否则返回EOF(-1)。
如果流为NULL,而且程序可以继续执行,fclose设定error number给EINVAL,并返回EOF。
【FROM MSDN && 百科】
fclose函数详解
本文详细介绍了C语言中的fclose函数,包括其原型、返回值以及如何正确地关闭文件流。此外还解释了_fcloseall函数的作用,即关闭所有打开的流,除了标准输入、输出和错误流。
6949

被折叠的 条评论
为什么被折叠?



