------- Comment #10 from jvdelisle at gcc dot gnu dot org 2008-01-24 05:15 ------- Answering your question. Putting the write in front of the failing one causes seeking to that record, writing it out and flushing the buffers. Writing "grows" the file. This creates "undefined" records from the beginning of the file up to the record written. With that the file actually has content and a length. (Hard to read record 10 on a file with length zero)
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34876