swappo1
September 6th, 2009, 03:39 AM
Hello,
Here is the function I am having problems with.
static void counter(Widget *w)
{
gchar *str = NULL;
gint len = 100;
static gdouble count = 1.0;
g_ascii_dtostr(str, len, count);
gtk_label_set_label(GTK_LABEL(w->label), str);
g_free(str);
count++;
gtk_widget_show(w->label);
}
I can't get g_ascii_dtostr(str, len, count) to convert the count to a string so I can put the count in the label. The program compiles fine. Here is the output.
[hopchewer@hopchewer foundations_exercises]$ ./ex_6-2
(ex_6-2:10733): GLib-CRITICAL **: g_ascii_formatd: assertion `buffer != NULL' failed
(ex_6-2:10733): GLib-CRITICAL **: g_ascii_formatd: assertion `buffer != NULL' failed
(ex_6-2:10733): GLib-CRITICAL **: g_ascii_formatd: assertion `buffer != NULL' failed
(ex_6-2:10733): GLib-CRITICAL **: g_ascii_formatd: assertion `buffer != NULL' failed
[hopchewer@hopchewer foundations_exercises]$
Any ideas?
Here is the function I am having problems with.
static void counter(Widget *w)
{
gchar *str = NULL;
gint len = 100;
static gdouble count = 1.0;
g_ascii_dtostr(str, len, count);
gtk_label_set_label(GTK_LABEL(w->label), str);
g_free(str);
count++;
gtk_widget_show(w->label);
}
I can't get g_ascii_dtostr(str, len, count) to convert the count to a string so I can put the count in the label. The program compiles fine. Here is the output.
[hopchewer@hopchewer foundations_exercises]$ ./ex_6-2
(ex_6-2:10733): GLib-CRITICAL **: g_ascii_formatd: assertion `buffer != NULL' failed
(ex_6-2:10733): GLib-CRITICAL **: g_ascii_formatd: assertion `buffer != NULL' failed
(ex_6-2:10733): GLib-CRITICAL **: g_ascii_formatd: assertion `buffer != NULL' failed
(ex_6-2:10733): GLib-CRITICAL **: g_ascii_formatd: assertion `buffer != NULL' failed
[hopchewer@hopchewer foundations_exercises]$
Any ideas?