title: I can't get my file to be read and printed properly in C, only prints out '0'
body: <pre><code>struct patient getPatient(FILE *fptr)
  {
      char fileInput[200];
      int noOfEntries = 0, n;
      while (!feof(fptr))
      {
          fscanf(fptr, "%499[^\n]*s", fileInput);
  
          for (n = 0; n &lt; FILENAME; n++ )
          {
          printf("%500c\n", fileInput);
          }
      }
  }
  </code></pre>
  
  <p>This is where the file is being read, and I open it in another function.</p>
  
  <pre><code>FILE *openFile(void)
  {
      FILE *fptr;
      char filename[FILENAME];
      printf("Enter filename: ");
      scanf("%s", filename);
      if (!(fptr = fopen(filename, "r")))
      {
          printf("Can't open file %s", filename);
          exit(1);
      }
      return fptr;
  }
  </code></pre>
  
  <p>And they are both called here.</p>
  
  <pre><code>FILE *fptr = openFile();
  getPatient(fptr);
  </code></pre>
  
  <p>It's either being opened incorrectly or not read correctly, I am reading it to a struct.</p>
  
  <pre><code>struct patient
  {
      char entryLine[500];
  };
  </code></pre>
  
  <p>EDIT: The new code, this block is more self-contained than last time I think. </p>
  
  <pre><code>void showPatientDetails(char fileName[70])
  {
      char fileInput[500];
      int n;
      FILE *fptr;
      if(!(fptr = fopen(fileName, "r")))
      {
          printf("\n\nUnable to open files! \n\n");
          exit(1);
      }
      while(fgets(fileInput, sizeof fileInput, fptr))
      {
          fscanf(fptr, "%499[^\n]", fileInput);
          printf("%500c\n", fileInput);
  //      for (n = 0; n &lt; FILENAME; n++ )
  //        {
  //            printf("%500c\n", fileInput);
  //        }
      }
  }
  </code></pre>
  
  <p>I've tried two methods, one we did yesterday and another one that my teacher used for something else.</p>