我只想写(追加)到日志文件.我在这里查了一下: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();
Run Code Online (Sandbox Code Playgroud)
APr*_*mer 30
fstream::app|fstream::out而不是fstream::app.app没有指定就没有意义out(人们可能会认为它应该暗示out,但事实并非如此).