The
std::filebuf::open() function implements, as an extension, the ability to create a temporary file that is automatically deleted on process exit (regardless of whether the exit is normal or otherwise). The function uses the
mkstemp
function on POISX platforms and
tempnam
function on Windows. In both cases, the function uses the
P_tmpdir macro for the directory where to create the temporary file. On POSIX systems it's customary to be able to set the
TMPDIR environment variable to a directory where temporary files should be created by programs. We should change our implementation so as to honor this convention. On Windows, there is an analogous environment variable
TMP. We should change our implementation on Windows to honor
TMP if it's set and use
P_tmpdir only when it's not.