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



On Mon, Oct 25, 1999 at 05:46:51PM -0400, Matthew D Allen wrote:

> 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.

One comment; in the context of gtk+, glib will be available, so it's better
to use g_snprintf or even g_strdup_printf

Regards,
-- 
  Q_.        Jasper Spaans  <mailto:jspaans@mediakabel.nl>        -o)
 `~\         Conditional Access/DVB-C/OpenTV/Unix-adviseur        /\\
Mr /\                                                            _\_v
Zap

PGP signature



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