[Qt-interest] Hi guys, fprintf problem

Fabio Giovagnini fabio.giovagnini at aurion-tech.com
Thu Apr 8 07:48:28 CEST 2010


Thank you very much to everyone getting part to the discussion
Thanks again, this solution works.

Thanks a lot

In data mercoledì 07 aprile 2010 23:53:12, Constantin Makshin ha scritto:
: > You may try to temporarily set the "LC_NUMERIC" parameter of the locale to
>  "C" or "POSIX":
> 
> #include <locale.h>
> ...
> char* oldLocale = setlocale(LC_NUMERIC, "C");
> fprintf(...);
> setlocale(LC_NUMERIC, oldLocale);
> 
> http://linux.die.net/man/3/fprintf
> http://linux.die.net/man/3/setlocale
> 
> On Thu, 08 Apr 2010 01:37:28 +0400, Fabio Giovagnini 
<fabio.giovagnini at aurion-tech.com> wrote:
> > Hi all,
> > I know this is not the best place where to ask about fprintf function,
> > but I do not know about glibc mailing list.
> > So sorry but let me ask.
> > I have Ubuntu 9.10 - Karmic Koala
> > in Italian language.
> > When I call
> > fprintf(fd,"%.2f",floatval);
> > into the file I find 0,84 supposed that floatval is 0.84; the function
> > use the Italian comma decimal separator instead of the universal dot
> > separator I supposed.
> > This is for me a problem beacuse such these decimal values are into a
> > comma separated file and with this notation my strtok based parser works
> > wrongly.
> >
> > How can I force fprintf to use dot decimal separator?
> > How caould to solve iun general this problem avoiding that fprintf detect
> > teh LOCALE and customizes its behaviour correspondingly?
> >
> > Thanks in advance and sorry again.
> 

-- 
Fabio Giovagnini

Aurion s.r.l.
P.I e C.F.
00885711200
Tel. +39.051.594.78.24
Cell. +39.335.83.50.919




More information about the Qt-interest-old mailing list