title: Why would I need stat to check if a directory already exists?
body: <p>From my homework:</p>
  
  <blockquote>
    <p>Backup files are stored in a hidden directory called .mybackup, which
    your program creates, if necessary. To create a directory, use the
    mkdir() function (click here for details), but be sure to check
    whether the directory already exists (using stat() or checking for
    EEXIST). If the directory already exists, do not overwrite it.</p>
  </blockquote>
  
  <p>I thought mkdir inherently returns -1 if the directory already exists. I definitely read that somewhere. Am I mistaken here?</p>