title: In C, how to print out a txt file line by line?
body: <pre><code>int main()
  {
     FILE *infile;
     FILE *infile2;
     char input[255],input2[255];
     int status1, status2;
  
     infile = fopen("test.txt", "r");
     infile2 = fopen("test2.txt", "r");
     if(infile == NULL)
     {
        printf("Can not open file 1!\n");
     }
     else if(infile2 == NULL)
     {
        printf("Can not open file 2!\n");
     }
     else
     {
        do
        {
          status1 = fscanf(infile, "%s", &amp;input);
          status2 = fscanf(infile2, "%s", &amp;input2);
  
          printf("File 1: %s\n File 2: %s\n", input, input2);
       }while(status1 != -1 || status2 != -1);
     }
     fclose(infile);
     fclose(infile2);
  
     return 0;
  }
  </code></pre>
  
  <p>My output looks like this:</p>
  
  <p><a href="http://i.stack.imgur.com/0ivEj.png">Output</a></p>
  
  <p>I would like to print out file 1 in one line not word by word. The same goes for file2. I'm kinda new to C so I'm stuck. </p>