调试模式下的流写操作 [英] ofstream write operation during debug mode

查看:89
本文介绍了调试模式下的流写操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello all



有没有人尝试过ofstream进行调试?在我的情况下,当它通过write语句时,没有任何内容写在文件上,但在正常运行时它会正常写入文件。我有一个错误,我需要检查日志文件,但通过调试。谢谢您的帮助! :)

Hello all

Does anyone tried ofstream on debugging ? In my case when it passes the write statement nothing is written on the file but on the normal run it writes to the file normally. I have a bug I need to check in the log file but through debugging. Thanks for the help! :)

推荐答案

所有与流相关的写操作都是缓冲的。 I. e。无论何时写入内容,数据都只会写入内部缓冲区,然后可能会或者可能不会刷新到输出流。您可以通过刷新或关闭流强制写入。请参阅 http://www.cplusplus.com/reference/ostream/ostream/flush/ [< a href =http://www.cplusplus.com/reference/ostream/ostream/flush/target =_ blanktitle =新窗口> ^ ]
All stream-related writing operations are buffered. I. e. whenever you write something, the data will only be written to an internal buffer, which may or may not then be flushed to the output stream. You can force the write by flushing or closing the stream. See http://www.cplusplus.com/reference/ostream/ostream/flush/[^]


这篇关于调试模式下的流写操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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