title: How to read cin with whitespace up until a newline character?
body: <p>I wish to read from cin in C++ from the current position up until a newline character into a string.  The characters to be read may include spaces.  My first pass fails because it stops on the first space:</p>
  
  <pre><code>string result;
  
  cin &gt;&gt; result;
  </code></pre>
  
  <p>If cin is given:</p>
  
  <pre><code>(cd /my/dir; doSometing)\n
  </code></pre>
  
  <p>The variable result only gets:</p>
  
  <pre><code>(cd
  </code></pre>
  
  <p>I would think I should be able to use stream manipulators to accomplish this, but the skipws was not quite right in that it throws carriage returns in with spaces and tabs, plus it sounds like that is for leading whitespace to be skipped.</p>
  
  <p>Perhaps I need to use streambuf something like this?</p>
  
  <pre><code>streambuf buf;
  
  cin &gt;&gt; buf;
  </code></pre>