title: Reading from boost serialized file throws exception
body: <p>I am new to c++ coding. 
  I am trying run this code on visual studios to read from boost serialized binary, and when I try to read from it, it throws exception.   </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;boost/archive/binary_oarchive.hpp&gt;
  #include &lt;boost/archive/binary_iarchive.hpp&gt;
  #include &lt;boost/serialization/binary_object.hpp&gt;
  
  
  using boost::serialization::make_binary_object;
  
  enum class Example : uint32_t {
      A = 1,
      B = 2,
  };
  
  int main() {
      int data = 5;
  
      std::ofstream f("data.dat", std::ios::binary);
      boost::archive::binary_oarchive ar(f);
      ar &lt;&lt; make_binary_object(&amp;data, sizeof(data));
  
      uint32_t restored_info;
      std::ifstream Obj_ifstream("data.dat", std::ios::binary);
      boost::archive::binary_iarchive ip_archive(Obj_ifstream);
      ip_archive &gt;&gt; restored_info;
  
      std::cout &lt;&lt; "Testing " &lt;&lt; std::endl;
      system("PAUSE");
  }
  </code></pre>
  
  <p><strong>Exception:</strong></p>
  
  <blockquote>
    <p>terminate called after throwing an instance of
    'boost::archive::archive_exception'<br>
    what():  input stream error</p>
  </blockquote>