title: fopen can create a file but cannot reopen file in C
body: <p>I am unable to open a file I just created using <code>fopen()</code>, I tried this code on both Linux and Windows. I also tried this code using complete path.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main() {
  
      char c;
      FILE *myFile = fopen("name.txt", "w"); //file name.txt created
      fprintf(myFile, "My name is %s", "Adam"); //text saved
      fclose(myFile); //file closed
  
      FILE *myOpenFile;
      if(myOpenFile = fopen("name.txt", "r") == NULL);
      {
          printf("No such file\n"); //no such file is executed
          return 0;
      }
  
      while (c=!EOF)
      {
          c = fgetc(myOpenFile);
          printf("%c", c);
      }
      fclose(myOpenFile);
  
      return 0;
  }
  </code></pre>