title: Reading a file, modifiying each line, storing it into a buffer, printing all at once
body: <p>This is the file:</p>
  
  <pre><code> line 1
   line 2
   line 3
  </code></pre>
  
  <p>How to read the file line by line... </p>
  
  <p>Append a suffix to each line..</p>
  
  <pre><code>FILE *fp = fopen ("file", "r");
  while (fgets (buffer, sizeof (buffer), fp) != NULL) {
  
      // append "test" to each line.
      // store the result in a buffer named "result"
  
  }
  fclose (fp);
  </code></pre>
  
  <p>print the result all at once:</p>
  
  <pre><code>printf( "%s", result );
  </code></pre>
  
  <p>Expected result :</p>
  
  <pre><code> line 1test
   line 2test
   line 3test
  </code></pre>