Comment faire pour ajouter un fichier avec fstream fstream::app drapeau semble ne pas fonctionner

je veux simplement écrire (ajouter) pour un fichier de log. J'ai regardé ici:

http://www.cplusplus.com/reference/iostream/fstream/open/

donc, c'est ce que j'ai fait

#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();
  • Vous pouvez également utiliser ofstream, votre code serait de travailler avec cela.
InformationsquelleAutor groovehunter | 2011-01-17