我只是想写入(附加)到日志文件。我在这里查了一下:
http://www.cplusplus.com/reference/iostream/fstream/open/ http://www.cplusplus.com/reference/iostream/fstream/open/
所以这就是我所做的
#include <fstream>
fstream outfile;
//outfile.open("/tmp/debug.txt" ); // works, simply for writing
outfile.open("/tmp/debug.txt", fstream::app ); // does nothing
outfile << "START" << endl;
outfile.close();
fstream::app|fstream::out
代替fstream::app
. app
没有指定就没有意义out
(人们可能认为这应该暗示out
,但事实并非如此)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)