Boost logo

Boost Users :

Subject: Re: [Boost-users] lexical_cast and float
From: asif saeed (asif.lse2_at_[hidden])
Date: 2011-06-20 03:10:58


Hi,

On Sun, Jun 19, 2011 at 10:56 PM, Igor R <boost.lists_at_[hidden]> wrote:

> > string value("3.14");
> > try { lexical_cast<float>(value); } catch(bad_lexical_cast& ) {
> cout<<value<<" is not a float number\n"; }
> > I always obtain a bad_lexical_cast exception.
>
> Perhaps, your locale requires comma as fp: "3,14"
>

But what if one did want to convert from "3.14" instead of "3,14"? How can
one specify the customization in this case?

Best regards, Asif



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net