title: c - fopen opening directories?
body: <p>I am using <code>fopen()</code> to determine whether I'm opening a file or a directory like this:</p>
  <pre><code>FILE *f;
  
  f = fopen(path, &quot;r&quot;);
  
  if (f != NULL){
  
  // found file
  
  }
  
  else {
  
  // found a directory
  
  }
  </code></pre>
  <p>And path is currently a path pointing to a directory, not a file and it looks something like this:</p>
  <pre><code>/home/me/Desktop/newfolder
  </code></pre>
  <p>However, when I run the code, it says that it found a file even though it's pointing to a folder and thus it should return NULL pointer, or not?</p>
  <p>I'm working on Ubuntu.</p>