p4-8.c

来自「SUN Solaris8平台下进程间通信」· C语言 代码 · 共 18 行

C
18
字号
#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include "err_exit.h"int main(void){    struct stat   statbuf;    /* 关闭调整组ID位并打开组执行位 */    if (stat("foo",&statbuf) < 0)        err_exit("stat error for foo");    if (chmod("foo", (statbuf.st_mode & ~S_IXGRP) | S_ISGID) < 0)        err_exit("chmod error for foo");    /* 直接设置方式至"-rw-r--r--"*/    if (chmod("bar", S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0)        err_exit("chmod error for bar");    exit(0);  }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?