Re: [gtk-list] newbie: Gint to string ?





Use sprintf();  This isn't a GTK+ question, it's one about the C language
pretty much.  gint's are practically equivalent to regular integers if
they aren't just straight out typedef'd to int's.

char buffer[512];

sprintf(buffer,"%d",my_gint_value);

foolabel = gtk_label_new(buffer);

Hope it helps.


David

http://opop.nols.com/index.shtml - Linux software development
There are three kinds of people:  Those who can count, and those who can't.

On Mon, 25 Oct 1999, hihihi wrote:

> 
> Hi i am a newbie in GTK...
> 
> 
> I want to do something like this :
> 
> gint new_val;
> 
> gtk_label_set_text(GTK_LABEL(label),new_val);
> 
> 
> I get this :
> 
> k8000_check_005.c:58: warning: passing arg 2 of `gtk_label_set_text'
> makes pointer from integer without a cast  
> 
> 
> How can i make a string from a gint ???
> 
> I can not find it in the docs file's or examples...
> 
> -- 
> My webserver http://hihihi.penguinpowered.com
> My home page at my provider http://www.casema.net/~hihihi
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 
> 



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