title: How to read the whole lines from a file (with spaces)?
body: <p>I am using STL. I need to read lines from a text file. How to read lines till the first <code>\n</code> but not till the first <code>' '</code> (space)?</p>
  
  <p>For example, my text file contains:</p>
  
  <pre><code>Hello world
  Hey there
  </code></pre>
  
  <p>If I write like this:</p>
  
  <pre><code>ifstream file("FileWithGreetings.txt");
  string str("");
  file &gt;&gt; str;
  </code></pre>
  
  <p>then <code>str</code> will contain only "Hello" but I need "Hello world" (till the first <code>\n</code>).</p>
  
  <p>I thought I could use the method <code>getline()</code> but it demands to specify the number of symbols to be read. In my case, I do not know how many symbols I should read.</p>