Re: gint to gchar: g_sprintf



Hi,


gint add = 10;

you should declare here gchar *addid:
gchar *addid = NULL;

and before the call to g_sprintf you should assign enough memory for this
variable too, for example:
addid = (gchar *) g_malloc (25);
will make addid to point to a piece of memory of 25 bytes (of chars)

g_sprintf(gchar *addid,"%d", add);

you should ommit the type specification of addid:
g_sprintf (addid, "%d", add);

Good luck,





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