Talk:Append a record to the end of a text file: Difference between revisions

Content added Content deleted
(→‎Changed: intent again (?))
Line 81: Line 81:


:: This is beginning to sound a bit like the intent may have been to demonstrate file appends from different tasks and not having records ending up all scrambled.--[[User:Dgamey|Dgamey]] 16:11, 26 September 2011 (UTC)
:: This is beginning to sound a bit like the intent may have been to demonstrate file appends from different tasks and not having records ending up all scrambled.--[[User:Dgamey|Dgamey]] 16:11, 26 September 2011 (UTC)

Single <code>write</code> to a file opened with <code>O_APPEND</code> is atomic if the underlying file system supports it. For example, it's not garanteed under NFS, where a lock is necessary (and still not garanteed to work, depending on the bugginess of OS). A <code>printf</code> by default calls flush on end of line if output is tty, otherwise tends to only flush when buffer is full. --[[User:Ledrug|Ledrug]] 22:10, 26 September 2011 (UTC)