Question about the Append?

26 views
Skip to first unread message

Wei Zhang

unread,
Mar 28, 2013, 9:00:28 AM3/28/13
to qfs-...@googlegroups.com
Hi,

I wrote a simple application to try out the (O_WRONLY | O_APPEND) mode, and I noticed the following:

1. After writing 10MB data to an newly created empty file, I saw the file size has grown to 64MB, which is equal to the chunk size.
2. After the write, I want to know the correct file size, so I called Tell(), but it returned 0.
3. After closing the fd, I also tried Stat(), but it returned 64MB.
4. I tried both RecordAppend() and Write(), I saw the same results.

My questions:
1. What is the underline difference between normal Write() and RecordAppend()?
2. What's the proper usage of RecordAppend()?
3. How do I know "where is my written data" under the append mode? Normally I would expect the current position of file pointer is the starting position for the next append.

Your help is greatly appreciated!

Wei
Reply all
Reply to author
Forward
0 new messages