title: Read next line in Text file C Programming
body: <p>I know about <strong><em>fscanf(), fgets()</em></strong> and those other functions to read the next line of a text file. However, if you are given a text file by <strong><em>'cat msg1.txt | ./anonymizer'</em></strong> would you use the same functions?
  For my program the code for the main is: </p>
  
  <pre><code>int main (void)
  {
      char input[1000]= {'\0'}; //the sentence the user will enter
      printf("Enter a sentence:");
      scanf("%[^\n]", input);
      char newSentence[1000]={'\0'};
      sentence=(char *) &amp;newSentence;
      line=getText(input,0);
      divide(input);
      printf("%s\n",sentence);
      return 0;
  }
  </code></pre>
  
  <p>In the command line I enter:</p>
  
  <pre><code>gcc -o anonymizer anonymizer.c
  cat msg1.txt | ./anonymizer
  </code></pre>
  
  <p>My msg1 text file contains: </p>
  
  <blockquote>
    <p>Hi, my email addresses are h.potter@hogwarts.edu and 1a@2b3c@lkj@
    Although it's not an email addresses, I'd hate if@ you saw my
    secret@word. Gary.zenkel@nbcuni.comHoever, input variable only
    contains the first line: 'Hi, my email addresses are
    h.potter@hogwarts.edu and 1a@2b3c@lkj@'</p>
  </blockquote>
  
  <p><strong>How can I get the input variable to contain the other two lines?</strong></p>