Opening with >> corresponds to an fopen(3) mode of "a". My fopen(3) man page says:
Opening a file in append mode (a as the first character of mode) causes all subsequent write operations to this stream to occur at end-of-file, as if preceded the call:fseek(stream,0,SEEK_END);
I suspect that fopen(..., "a") accomplishes this by using the O_APPEND flag of open(2) on modern Linux systems. On such systems, the implied seek & write would a single atomic operation (ignoring NFS).
In reply to Re: Safe to open+close for every write, without locking?
by Neutron Jack
in thread Safe to open+close for every write, without locking?
by sedusedan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |