Opening file in Append mode : using open() API
i am trying to open a file in append mode using open() api call , how开发者_开发问答ever following code is not working ! Its not writing anything to file! here is my code :
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
.
精彩评论