title: How to delete a certain line in a text file?
body: <p>Can you help me code a program that deletes a certain line in a text file.</p>
  
  <p>I'm planning to use:</p>
  
  <ol>
  <li><p>fgets to capture a line from text file and store it in an array, but i was confused how does fgets store the line in an array(does it capture the line and store it in the first index and the next time it captures a line will this be stored to the next index or just overwrite the first index of an array?)</p></li>
  <li><p>if the line was stored in different indices I'll then have a condition that compares the user's input to the captured line of fgets and if it is equal, it will skip the line and do the rule till it reaches the end of file.</p></li>
  <li><p>then I'll close the text file like this fclose(stream) and reopen it as "wt" to overwrite everything written at the file.</p></li>
  </ol>
  
  <p>Am I having the right logic... or you can suggest better solutions...
  hope you can help me understand how fgets store the line in an array...</p>
  
  <p>btw this is the code I'm trying for my testing:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;string.h&gt;
  struct studentinfo{
         char id[8];
         char name[30];
         char course[5];
  }s1;
  int main(void){
       FILE *stream = NULL;
       stream = fopen("studentinfo.txt", "rt");
  
       char arr[100];
       int i=0;
  
      while(!feof(stream)){  
       fgets(arr, 100, stream);
       printf("%s", arr);
       }
       fclose(stream);
  /*planning to reopen the stream but will change "rt" to "wt"*/
  
       getch();
  }
  </code></pre>