[ardour-dev] i18n serialization

Paul Davis paul at linuxaudiosystems.com
Wed Dec 1 20:23:50 PST 2004

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.



/* 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;

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;

More information about the Ardour-Dev mailing list