Opening file in Append mode : using open() API

后端 未结 1 1453
-上瘾入骨i
-上瘾入骨i 2021-01-18 05:19

i am trying to open a file in append mode using open() api call , however following code is not working ! Its not writing anything to file! here is my code :

相关标签:
1条回答
  • 2021-01-18 05:33

    O_APPEND is not a mode by itself; it's a flag. Since the value of O_RDONLY is 0, it's like you're trying to open the file read-only but for append, which is nonsense. Use O_WRONLY|O_APPEND or O_RDWR|O_APPEND.

    0 讨论(0)
提交回复
热议问题