Page 1 of 1

Floating point string format

Posted: Fri Feb 10, 2012 11:32 am
by Crashy
Hello everybody.

I've got a nice issue right here. When I launch my game with it's own executable, everything runs fine.
If I run it within a wxwidget application, material parameters are wrong.

The cause? The floating point string format, which is "," in french system, and "." in us-en systems. So for example, sccanf will return either 0.05 or 0 when parsing this string
"param_named_auto psTime time 0.05", depending on which application I execute, the game or my wxwidget tool.

Of course I don't want to have multiple version of my material files, so I wonder if there is a way to force, at application startup, the format of the floating point in strings?

I also don't want to force users to change their system settings before running application.

Thanks.

Re: Floating point string format

Posted: Fri Feb 10, 2012 11:38 am
by lingfors
http://msdn.microsoft.com/en-us/library/x99tb11d.aspx

If you're not running on Windows, I'm sure there's something similar.

Re: Floating point string format

Posted: Fri Feb 10, 2012 11:52 am
by Crashy
Thank you, I'll try it out.

Edit: it works, thanks.

Re: Floating point string format

Posted: Fri Feb 10, 2012 2:22 pm
by Klaim
There are cross-platform ways to make it work : http://www.cplusplus.com/reference/std/locale/

Also, maybe read this tutorial from Boost.Locale that explain why it's flawed : http://www.boost.org/doc/libs/1_48_0/li ... cales.html