The following code fails to create the file on /tmp. This happens even if I execute the binary as sudo
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream of("/tmp/DIR1/DIR2/test_file",std::ios::out | std::ios::trunc);
of.close();
return 0;
}
If I remove DIR1/DIR2/ from the file path, a test_file does get created on /tmp. I am using linux mint.
Whats happening here?
Aucun commentaire:
Enregistrer un commentaire