I commend your suggestions, wrt the testing of the success (or otherwise) of calls, to the house.

I would, however, debate your suggestion that ...your open call isn't succeeding... since the OP 'sees' a new file on each run - ergo, it strikes me that, as other, for more learned monks, have already pointed out elsewhere on this thread, the OP is suffering from buffering.

I'm not completely sure that a failed open() call cannot leave an entry in the file system. On the other hand, buffering is the most likely cause of this "failure" (I expected the OP to have read the file after killing the process, which would have resulted in output if buffering is the problem).

When putting a smiley right before a closing parenthesis, do you:

Use two parentheses: (Like this: :) )
Use one parenthesis: (Like this: :)
Reverse direction of the smiley: (Like this: (: )
Use angle/square brackets instead of parentheses
Use C-style commenting to set the smiley off from the closing parenthesis
Make the smiley a dunce: (:>
I disapprove of emoticons
Other