title: reading a line from ifstream into a string variable
body: <p>In the following code :</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main() {
      string x = "This is C++.";
      ofstream of("d:/tester.txt");
      of &lt;&lt; x;
      of.close();
  
  
      ifstream read("d:/tester.txt");
      read &gt;&gt; x;
      cout &lt;&lt; x &lt;&lt; endl ;
  }
  </code></pre>
  
  <h2><code>Output :</code></h2>
  
  <p><code>This</code></p>
  
  <p>Since >> operator reads upto the first whitespace i get this output. How can i extract the line back into the string ?</p>
  
  <p>I know this form of <code>istream&amp; getline (char* s, streamsize n );</code>  <strong>but i want to store it in a string variable.</strong>
  How can i do this ?</p>