title: Using stringstream to indent/center output
body: <p>I'm learning c++ and got the project to send a pascal's triangle to output (after n-rows of calculation)., getting output like this, stored in a stringstream "buffer"</p>
  
  <pre><code> 1
   1 1
   1 2 1
   1 3 3 1
  </code></pre>
  
  <p>But what I want is rather</p>
  
  <pre><code>    1
     1 1
    1 2 1
   1 3 3 1
  </code></pre>
  
  <p>My idea was: calculate the difference of the last line and current line length (I know that the last one is the longest). Then pad each row using spaces (half of the line-length-difference).
  My Problem now is:</p>
  
  <ul>
  <li>I didn't get how getLine works, neither how I might extract a specific (-> last) line</li>
  <li>I don't know and could not find how to edit one specific line in a stringstream</li>
  </ul>
  
  <p>Somehow I got the feeling that I'm not on the best way using stringstream.</p>
  
  <p>So this is rather a common question: How'd you solve this problem and if possible with stringstreams - how?</p>