Problem:
I have a QT based multiplatform (win,mac,*nix) application that parses ascii files containing decimal numbers.
parsing is done using a variety of different code pieces that use anything from qt string stuff, c++ stdin, oldstyle scanf, etc.
ascii files have always the '.' (dot) as separated decimal (e.g. in the file to be parsed 1/10 is written 0.1 as standard in many countries).
people using the application within a OS localized for using comma separated decimal encounter a lot of problems (e.g. for french users scanf expect to find 0,1 as a valid textual representation of 1/10 and if they find 0.1 scanf will parse it as 0)
How can I be sure that the OS Locale indication of how decimal point has to be written is always ignored?
Is it safe assuming that adding
QLocale::setDefault(QLocale(QLocale::English,QLocale::UnitedStates));
is enough to get rid of all these problems? Any suggestion for portable ways of setting the locale globally?