[ardour-dev] i18n serialization

Martijn Sipkema m.j.w.sipkema at student.tudelft.nl
Thu Dec 2 05:42:59 PST 2004


You don't setlocale()..?


--ms

----- Original Message ----- 
From: "Paul Davis" <paul at linuxaudiosystems.com>
To: <ardour-dev at lists.ardour.org>
Sent: Thursday, December 02, 2004 05:23
Subject: [ardour-dev] i18n serialization


> you are invited to try to get this program to misbehave by setting
> some locale-related environment variables. i seem unable to do so,
> despite what man 3 printf says about LC_NUMERIC ...
> 
> in theory using LC_NUMERIC=da_DK should change the print format of the
> larger floating value, and nl_NL should change the scanning of the
> "str" variable.
> 
> --p
> 
> 
> ---------------------------------------
> 
> /* save as is.cc then compile with g++ -o is is.cc */
> 
> #include <stdio.h>
> #include <unistd.h>
> #include <stdlib.h>
> 
> #include <iostream>
> 
> using namespace std;
> 
> int
> main (int argc, char *argv[])
> {
> char* str = "13,2";
> float val;
> 
> printf ("LC_NUMERIC=%s\n", getenv ("LC_NUMERIC"));
> 
> if (sscanf (str, "%f", &val) != 1) {
> fprintf (stderr, "not scanned\n");
> } else {
> printf ("scanned value is %f\n", val);
> }
> 
> val = 13.2;
> 
> printf ("%.2f\n", 1234567.89);
> 
> printf ("printf gives %f\n", val);
> cerr << "c++ iostreams says " << val << endl;
> }
> _______________________________________________
> ardour-dev mailing list
> ardour-dev at lists.ardour.org
> http://lists.ardour.org/listinfo.cgi/ardour-dev-ardour.org
> 



More information about the Ardour-Dev mailing list