title: How to get a temporary file name?
body: <p>I've seen some posts relating to my question, but none that address it completely.  I need to create a file in the standard temporary directory and after I'm done writing to it, move it to a different location.  The idea is that the file is considered temporary while being downloaded and permanent after downloading completes.</p>
  
  <p>I'm attempting this by calling either <a href="http://www.linuxmanpages.com/man3/mkstemp.3.php">mkstemp</a> or <a href="http://www.linuxmanpages.com/man3/tmpfile.3.php">tmpfile</a>, then <a href="http://www.linuxmanpages.com/man2/rename.2.php">rename</a> after I'm done writing to it.  However, I need the full path of the file to call rename, and apparently getting the file name from a file descriptor (returned by mkstemp) or FILE * (returned by tmpfile) is no trivial process.  It can be done, but it's not elegant.</p>
  
  <p>Is there a system call that will create a temporary file and provide me with the name?  I know about <a href="http://www.linuxmanpages.com/man3/mktemp.3.php">mktemp</a> and related calls, but they either aren't guaranteed to be unique or are deprecated.  Or perhaps there is a better way to accomplish creating, writing to, and moving temporary files.</p>