title: fopen returns invalid argument in C
body: <p>I searched the forum, and can't find the answer to this problem. It seems to be common, but none of the mentioned fixes are applicable.</p>
  
  <p>This is my code for opening a file:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  void main() {
      FILE *input;
      char path[200];
  
      printf("Enter the full file path and file name in the following format:"
          "\nC:\\Users\\Username\\etc......\\filename.extension\n");
      fgets(path, 200, stdin);
      printf("%s",path);
      input=fopen(path,"r");
      if (input==NULL) {
          perror("The following errors were encountered");
          return(-1);
      }
  }
  </code></pre>
  
  <p><code>printf(%s,path)</code> correctly displays the path and name of the file I want to open, but fopen always returns invalid argument. I have also tried using a pointer to path in fopen, but this always crashes the program.</p>