How do I find the 'temp' directory in Linux? I am writing a platform neutral C++ function that returns the temp directory. In Mac and Windows, there is an API that returns these results. In Linux, I'm stumped. ----------------------------------------
Check following variables:
TMPDIR
P_tmpdir
If all fails try to use the directory /tmp.
/tmp
You can also use tempnam function to generate a unique temporary file name.
tempnam
1.4m articles
1.4m replys
5 comments
57.0k users