您的位置:首页 > 编程语言 > C语言/C++

【转】C语言fclose函数了解

2015-12-02 16:01 387 查看
原网址:http://blog.csdn.net/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 && 百科】
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: