in reply to Re^2: read from a file and write into the same file
in thread read from a file and write into the same file

strace-ing the OP's code (where nothing is being written) shows

... open("test.txt", O_RDWR|O_APPEND|O_CREAT|O_LARGEFILE, 0666) = 5 _llseek(5, 0, [57], SEEK_END) = 0 ...

which I would interpret to mean that the file pointer is positioned.

(_llseek is a Linux-specific syscall)

Replies are listed 'Best First'.
Re^4: read from a file and write into the same file
by ysth (Canon) on Mar 03, 2008 at 07:49 UTC
    Right, as far as I know you can count on it being at the end (or at least, the end as of the time of the open) even before the first write on linux. But it isn't guaranteed in general by POSIX.