gpt4 book ai didi

c - C 中的任何系统调用以更改 HP-UX 中文件的权限

转载 作者:太空宇宙 更新时间:2023-11-04 06:42:50 26 4
gpt4 key购买 nike

C 中的任何系统调用都可以更改 HP-UX 中文件的权限??

最佳答案

请参阅 sys/stat.h 中的 chmod ( documentation )。下面的示例来自文档。 HP-UX 符合 POSIX,因此您可以使用这些函数以及 C 库中的标准函数。

The following example sets the file permission bits for a file named /home/cnd/mod1, then calls the stat() function to verify the permissions.

#include <sys/types.h>
#include <sys/stat.h>

int status;
struct stat buffer
...
chmod("home/cnd/mod1", S_IRWXU|S_IRWXG|S_IROTH|S_IWOTH);
status = stat("home/cnd/mod1", &buffer;);

关于c - C 中的任何系统调用以更改 HP-UX 中文件的权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5551557/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com