开发者

What permissions does a file written with fstream have?

Suppose I create a file for writing like this:

std::ofstream my_file("filename", std::ios_base::out | std::ios_base::trunc);

How are the permissions of this file determined? I've had a program run开发者_运维知识库ning overnight generating files about once a minute - some are 0644 but others are 0660, and there's nothing in my code that should make it change. (I've seen that some implementations allow a third argument to set the file permissions - I'm using gcc 4.1.2 which doesn't appear to support this).


It depends on the umask.


default attrs are set with umask command. it not explains your files attrs changes, but still may be useful for you

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜