Re: gtk_label_set_text



On Fri, 07 Jan 2005 12:51:11 -0500, Dean McCullough <dpmccul comcast net> wrote:
> I would like to use a label (or something similar) to provide feedback
> to the user on the current value of a parameter (level).
> 
> I would like to use code simular to the following:
> 
> char lab[10];
> sprintf(lab,"Level %d",level);
> gtk_label_set_text( GtkLabel *Llabel,
>                           lab);
> 
> However, this does not work, since the second parameter to
> gtk_label_set_text is type const char.
> 
> Any ideas of a simple way to accomplish this?

This is fine, "const" in gtk_label_set_text only ensures that
gtk_label_set_text wont modify your string, OTOH; you will
get compiler warnings if you have a "const gchar *" and pass it
to a function that takes "gchar *".

Cheers,
                                                  -Tristan



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