Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top