previous | start | next

Appending

To open an existing file without destroying its contents, you can open it for appending additional bytes:

        int fd;
        fd = open("foo.txt", O_WRONLY | O_APPEND, 0);
     

The third parameter of 0, will not change the permissions of the existing file.

In fact the third parameter can be omitted for reading and appending existing files.



previous | start | next