【发布时间】:2011-06-10 09:03:07
【问题描述】:
我只是想写(追加)到一个日志文件。我在这里查到了:
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();
【问题讨论】:
-
您也可以使用 ofstream,您的代码可以使用它。