set directory of tmpfile() on Linux
-
21-09-2019 - |
문제
A program I use is failing when it uses tmpfile() for large files. The problem seems to be I don't have permission to create large files in /tmp, which this function uses by default. So is there a way, perhaps with an environmental variable, that I can make tmpfile() write to a different location?
Edit: the program in question is sox, which uses C.
해결책
You can use the environment variable TMPDIR to to tell tmpfile() where to create files:
sh syntax:
TMPDIR=/path/to/whatever; export TMPDIR
csh syntax:
setenv TMPDIR /path/to/whatever
다른 팁
Given the information in man tmpfile (3)
you may want to: #define P_tmpdir "/somedir"
Of course, this probably isn't too reliable.
You can also set your environmental variable, TMPDIR
to some location.
제휴하지 않습니다 StackOverflow