temp files under C
Hello,
what is the safest way to open/create a temporary file under C, and
get a string with the filename?
So far, I have seen:
tmpfile looks ok, but how do I get the filename?
tmpnam not secure
tmpnam_r not secure
tempnam not secure
mktemp not secure
mkstemp returns a file handle, but I want a FILE*.
so, at the moment mkstemp combined with fdopen looks the most hopeful.
Is this the best way?
However, that man page says:
Don't use this function, use tmpfile(3) instead. It's bet
ter defined and more portable.
:-(
...also I assume (hope!) that mkstemp doesn't delete the file when it
is closed. Is this correct?
--
Brian May <bam@debian.org>
Reply to: