title: fopen() returning a NULL pointer, but the file definitely exists
body: <p>The code I have is as follows:</p>
  
  <pre><code>FILE *txt_file = fopen("data.txt", "r");
  if (txt_file == NULL) {
      perror("Can't open file");
  } 
  </code></pre>
  
  <p>The error message returned is:</p>
  
  <blockquote>
    <p>Can't open file: No such file or directory</p>
  </blockquote>
  
  <p>The file 'data.txt' definitely exists in the working directory (it exists in the directory that contains my .c and .h files), so why is fopen() is returning a NULL pointer?</p>