Comment

Fredrik

Use the Tempfile class! It will take care of everything for you and return a familiar file-like object.

The lower level C library wrappers are not really necessary most of the time.

And Richard pointed it out but it deserves to be mentioned again. DO NOT THROW AWAY the integer returned by mkstemp if you choose to use it.

Really, don't.