[Boost-bugs] [Boost C++ Libraries] #7661: lexical_cast throws exception when strings have more than one null terminators

Subject: [Boost-bugs] [Boost C++ Libraries] #7661: lexical_cast throws exception when strings have more than one null terminators
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-11-07 21:07:32


#7661: lexical_cast throws exception when strings have more than one null
terminators
-------------------------------+--------------------------------------------
 Reporter: pengxu7@… | Owner: apolukhin
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: lexical_cast
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: |
-------------------------------+--------------------------------------------
 Hello,

 I got following exception while using boost 1.52.0:
 "
 terminate called after throwing an instance of 'boost::bad_lexical_cast'
   what(): bad lexical cast: source type value could not be interpreted as
 target
 "

 Here's the sample code:
 "
 #include <iostream>
 #include <boost/lexical_cast.hpp>

 int main( int argc, char** argv )
 {
    std::string m = "0";
    m += '\0';
    int i = boost::lexical_cast<int>( m );
    std::cout << "Got number " << i << std::endl;
 }
 "

 Thanks,
 Peng

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7661>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:11 UTC