Opening a file in upload mode: using the open () API

I am trying to open a file in append mode using the open () api call, however the following code does not work! It does not write anything to the file! here is my code:

enter image description here

+5
source share
1 answer

O_APPENDis not in itself; this is a flag. Since the value O_RDONLYis 0, it looks like you are trying to open the file read-only, but to add, which is nonsense. Use O_WRONLY|O_APPENDor O_RDWR|O_APPEND.

+14
source

All Articles