How to set file permissions (cross platform) in C++?

前端 未结 8 967
孤城傲影
孤城傲影 2020-11-27 05:08

I am using C++ ofstream to write out a file. I want to set the permissions to be only accessible by the user: 700. In unix; I suppose I can just issue a s

8条回答
  •  离开以前
    2020-11-27 05:26

    There's no standard way to do this in C++, but for this special requirement you should probably just write a custom wrapper, with #ifdef _WIN32. Qt has a permission wrapper in it's QFile class, but this would of course mean depending on Qt ...

提交回复
热议问题