Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ファイルを作成しようとしていますが、ロック モードで開いています。読み書き実行モードにする方法は?
switch(choice){ case 1: printf("\n Enter the file: "); scanf("%s", file); open(file, O_CREAT, S_IRWXG); break;
open の 3 番目の引数は、実際には定義済みフラグの 1 つである必要はありません。すべてのユーザーに対して +rwe モードで使用する場合は、コードを次のように変更します。
open(file, O_CREAT, 0777);
編集:フラグを使用したい場合。それらを | で組み合わせるだけです。指図。実際には同じ値を渡すことになりますが、多くの人はフラグを使用することを好みます。