Re: [gnome-db] Numeric with commas...



2006/2/6, Juan Pablo <jpdborgna yahoo com ar>:
> Hi list.
> I'm trying to do an insert to a table using the contents of a spin
> button, but because my locale the decimal serparator is a comma (,)
> instead of a . and it fails. The line is like this (but getting of 12
> spins instead of 1...) :
>
> buffer=g_strdup_printf("INSERT INTO productos (stock) VALUES ('%.2f')",
> gtk_spin_button_get_value(GTK_SPIN_BUTTON(lookup_widget(GTK_WIDGET(button),"stock"))));
>
> I use postgresql and my locale settings are es_AR.

You can try to use setlocale() before and after the printf: before to
set it to "C" and after to "" to return to your current locale.

Or maybe use printf ("%d.%d", (int) value, (int) ((value - (int) value) * 100))

Cheers,

Vivien



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]