On 11/28/18 11:01 AM, Jean-Marc Lasgouttes wrote: > Le 28/11/2018 à 15:23, Kornel Benko a écrit : >> I fear, we have to wait until the c++17 is available. >> What we do now, is calling >> ofstream ofs(encoded_fname.c_str(), ios::out|ios::trunc); >> write(ofs); >> We are unable to set own permissions. With c++17 it will be available >> to set them. >> See >> >> https://stackoverflow.com/questions/33552166/setting-file-permissions-when-opening-a-file-with-ofstream >> > > Does Qt have something to offer in this respect?
Yes, QFile::setPermissions: http://doc.qt.io/archives/qt-4.8/qfile.html#setPermissions We can use QFile::permissions to get the permissions of the original file, if we want to do that. Presumably, we could create simple wrappers around these in support::FileName or support::filetools, though note that they take and return a Permissions enum that Qt defines, so that would also have to be wrapped somehow. Riki