Using the open() system call

前端 未结 5 1700
说谎
说谎 2020-12-17 17:11

I\'m writing a program that writes output to a file. If this file doesn\'t exist, I want to create it.

Currently, I\'m using the following flags when calling open: O

5条回答
  •  醉梦人生
    2020-12-17 17:51

    On Linux there's a third argument you can use to pass permissions. S_IWUSR should be the flag to give you write permissions, but in practice you'll probably want to use more flags than just that one (bitwise or'd together). Check the manpage for a list of the permission flags.

提交回复
热议问题