继续问 关于CArchive()构造函数第二个参数 bNoFlushOnDelete属性

heiheizh618 heiheizh618 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我查了下MSDN,以下是相关描述:
CArchive::bNoFlushOnDelete
Prevents the archive from automatically calling Flush when the archive destructor is called. If you set this flag, you are responsible for explicitly calling Close before the destructor is called. If you do not, your data will be corrupted.

这个属性设置的目的是 在对象析构之前,自己显式调用CArchive::Close()函数;

但是Close()函数的作用是:
Flushes any data remaining in the buffer, closes the archive, and disconnects the archive from the file.
这里也是需要清除缓冲的。


问题是:什么情况下要设置这个属性,为什么要设置这个属性?
...全文
评论 5
收藏 已收藏
分享
返回顶部
heiheizh618
VC/MFC 16,550 成员 421,606 内容