Why does open() create my file with the wrong permissions?

前端 未结 7 1696
天涯浪人
天涯浪人 2020-11-29 23:47

I am trying to read some text from a file and write it to another using open(), read() and write().

This is my open()

7条回答
  •  抹茶落季
    2020-11-30 00:10

    Reading http://linux.die.net/man/2/open it seems you missed the mode parameter for open:

    mode must be specified when O_CREAT is in the flags, and is ignored otherwise. The argument mode specifies the permissions to use in case a new file is created.

提交回复
热议问题