title: Console not waiting for input. (C language)
body: <p>When I execute my code below. It waits for my input for entering a file name. But it doesn't wait for me to enter a filename, but rather just skips it to the _getch() part of it. I'm unable to add a sentence. </p>
  
  <p>Code not working:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  main() {
  
      FILE *fp;
      char fnamer[100] = "";      //Storing File Path/Name of Image to Display
      printf("\n\nPlease Enter the Full Path of the Image file you want to view: \n");
      scanf("%s", &amp;fnamer);
      fp = fopen(fnamer, "w");
      if (fp == NULL)
      {
          printf("\n%s\" File NOT FOUND!", fnamer);
      }
      char c[1000];
      printf("Enter a sentence:\n");
      gets(c);
      fprintf(fp, "%s", c);
      fclose(fp);
      _getch();
  }
  </code></pre>
  
  <p>Code that works and waits for entering a sentence:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;  /* For exit() function */
  int main()
  {
      char c[1000];
      FILE *fptr;
      fptr = fopen("program.txt", "w");
      if (fptr == NULL){
          printf("Error!");
          exit(1);
      }
      printf("Enter a sentence:\n");
      gets(c);
      fprintf(fptr, "%s", c);
      fclose(fptr);
      return 0;
  }
  </code></pre>
  
  <p>Both are so similar right there in the end for the prompt asking for a sentence. It doesn't make sense.</p>