title: R6010 abort() has been called
body: <p>I read about substr from here </p>
  
  <p><a href="http://www.cplusplus.com/reference/string/string/substr/" rel="nofollow">http://www.cplusplus.com/reference/string/string/substr/</a></p>
  
  <p>Here is my code :</p>
  
  <pre><code> int main()
  {
  std::ifstream in ("c:\\users\\admin\\desktop\\aaa.txt");
  std::ofstream out ("c:\\users\\admin\\desktop\\bbb.txt");
  std::string s ;
  while ( getline (in,s) )
  {
  
      std::size_t startpos = s.find("test");
  
      std::string str = s.substr (startpos);
  
      out &lt;&lt; str &lt;&lt; endl;
  
  }
    in.close();
   out.close();
  }
  </code></pre>
  
  <p>I get error : R6010 abort() has been called </p>
  
  <p>Note : aaa.txt contains spaces/characters/html tags</p>
  
  <p>Any idea ?</p>