openとchmod
apropos chmodコマンドで数パターンのmanコマンドがあるのが確認できる。
man 2 chmodでc言語で使う関数の方が確認できる。
#include <stdio.h> #include <fcntl.h> #include <sys/stat.h> int main(){ int fp; fp = open ("foobar.txt", O_WRONLY | O_CREAT); if(fp != -1) chmod("foobar.txt", S_IRWXU | S_IRWXG | S_IRWXO); return 0; }