title: Are ifstream/ofstream really used for serialization?
body: <p>I am using ifstream and and ostream to serialize my data but I am surprised to discover the `&lt;&lt;' operator can't seperate two adjacent strings and seperating them would be quite complicated.</p>
  
  <pre><code>class Name
  {
  string first_name;
  string last name;
  
  
  friend std::ostream&amp; operator&lt;&lt; (std::ostream&amp; os, const Name&amp; _name)
  {
       os &lt;&lt; _name.first_name &lt;&lt; _name.last_name; 
       return os;
  }
  
  friend std::istream&amp; operator&gt;&gt; (std::istream&amp; is, Name&amp; _name)
  {
       is &gt;&gt; _name.first_name &gt;&gt; _name.last_name;
  
       return is;
  }
  </code></pre>
  
  <p>This doesn't work because &lt;&lt; and >> doesn't write null terminator characters and ifstream reads the whole string in variable (first_name) which is kinda disappointing. How can I store the two strings separately so I can read them separately as well? I don't understand what is the motivation of <code>&lt;&lt;</code> concatenating all the strings in ostream so we can't read them back seperatly!?</p>