dimanche 30 octobre 2016

Why file is not created in /etc/ directory

Please find the code sample

void createFile(const std::string& FileName, const std::string& Content)
{
    ofstream of(FileName.c_str());
    of<<Content;
    of.close();
}
const std::string testFile = "/etc/testFile";
const std::string EmptyContent = "";
createFile(testFile, EmptyContent);

File is not creating at /etc/ directory. I think this is related to permissions. What extra I have to add in the code to work.

Aucun commentaire:

Enregistrer un commentaire