I seem to have mistated myself. What I meant to say is that the data has not yet been written to the file when he attempts to read from it and turning on autoflush would take care of that problem. You are correct about flushing on close. In the sample code here there is no close, so I must assume that he is trying to read from the file just after the write and before any close on the associated file handle.