warning: the use of `tmpnam' is dangerous, better use `mkstemp'
<p><em>(Note: This is <strong>not</strong> a duplicate question)</em></p>
<p>I'm using the libc function <code>tmpnam</code>, and getting the following warning:</p>
<pre><code>warning: the use of 'tmpnam' is dangerous, better use 'mkstemp'
</code></pre>
<p>My question isn't &quot;how to disable the warning&quot;, but rather &quot;what function should I be using instead&quot;? <code>mkstemp</code> doesn't help, because I'm not trying to create a temporary file - I'm creating a temporary <em>directory</em>. And AFAIK, there isn't an API function for that.</p>
<p>So if I'm not supposed to use <code>tmpnam</code>, what <em>am</em> I supposed to use?</p>