开发者

Creating a new file with group permissions

This seems straight开发者_开发技巧 forward enough , but i have not been able to identify how i could achive this in C++.

I am creating a file as

ofstream logfile(LOG_FILE, ios::out | ios::app);

The file is created with the following permissions.

-rw-r--r-- 

What i really want is

-rw-rw-rw- 

For obvious reasons , i do not want to change the system umask for the same.

Thanks!


Take a look at the chmod call. This is used to change the permissions of a file.


There is currently no way to set the file permissions with standard C++. I suggest you use the chmod() system call, or equivalent if running on a non-unix OS.


include

mode_t mode=00777; chmod("operate.sh", mode);

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜