title: What's the difference between tempfile and mktemp?
body: <p>Most systems I've encountered have both <code>tempfile(1)</code> and <code>mktemp(1)</code>. There are syntactic differences, and <code>mktemp</code> can also create directories, but they otherwise seem to do the same thing.</p>
  
  <p>Is there any difference between the two? Why do both exist? Is one more standard than the other? If I just want to create a temporary file safely, is there any reason to prefer one over the other?</p>
  
  <p>I suspect there's some interesting Unix lore behind this, but my searches turn up nothing.</p>