为什么我们必须使用fclose()? [英] Why do we have to use fclose() ?

查看:137
本文介绍了为什么我们必须使用fclose()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么在文件关闭之前,即在调用fclose()之前我无法看到文件内容,我尝试使用断点查看文件内容?



专家请帮助我...

Why I cant see the file content once it is written to a file before the file is closed i.e. before calling fclose() I tried to view the file content using breakpoints?

Experts Pls help me...

推荐答案

阅读文档:http://www.cplusplus.com/reference/cstdio/fclose/ [ ^ ]


读/写缓存在C / C ++(以及更多语言和操作系统)中,所以直到你关闭文件可能不完整(甚至部分已写入)...

Read/write are buffered in C/C++ (and in many more languages and OSs) so until you close the file it may not be complete (even parts of it are already written)...
MSDN:

所有缓冲区在关闭之前刷新与流关联的

all buffers associated with the stream are flushed prior to closing

http://msdn.microsoft.com/en -us / library / fxfsw25t.aspx [ ^ ]


这篇关于为什么我们必须使用fclose()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆