Gazebo | Ignition | Community
Ask Your Question

boost::lexical_cast<std::string>(port) == "11,345"

asked 2016-02-05 10:11:20 -0600

Mr_Orion gravatar image

boost::lexical_cast<std::string>(port) is a big problem because result of this function depends of locale. And if locale is defined in process, result will be with delimeters, like this ",". And we will have port = "11,345".

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-02-05 11:07:50 -0600

nkoenig gravatar image

I believe we need to use:

setlocale(LC_NUMERIC, "C");

For reference see this pull request.

Can you try setlocale?

edit flag offensive delete link more

answered 2016-02-08 03:56:37 -0600

Mr_Orion gravatar image

Yes I resolved this problem by setlocale. But I changed process locale and it changes behavior of process. Can I change locale to previos, after exiting from client::setup()?

edit flag offensive delete link more


You should be able to get a locale using localeconv(), and then restore this locale after `client::setup`.

nkoenig gravatar imagenkoenig ( 2016-02-08 09:45:58 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-02-05 10:11:20 -0600

Seen: 170 times

Last updated: Feb 08 '16