Re: more on g_strconcat problem



Hi,

"Carl B. Constantine" <duckwing duckwing ca> writes:

> Ok, I've definately nailed the problem down to an issue with the check
> button in my data entry box. But it still doesn't make sense. consider
> the following code:
> 
> idRequired = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(customers, "cust_id_req")));
>   g_print("ID Required status: %d\n", idRequired);
>   
>   toggleTest = (gint)idRequired;
>   g_print("ID Required status: %d\n", toggleTest);
> 
> the above code prints 0 if the checkbox is unchecked and 1 if it is
> checked. 
> 
> With that in mind, consider the following additional code:
> 
> sql = g_strconcat("insert into customers (id_req) values('", toggleTest, "')",0L);

You must pass strings to g_strconcat(). Strings are NULL-terminated
character arrays, not integers.

BTW. your g_strconcat() construct from the last mail gets the price
for the ugliest piece of C code I've ever seen.


Sven



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