Re: Re: GtkLabel and text from int variable



U¿ytkownik Martyn Russell <martyn imendio com> napisa³:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>przemu op pl wrote:
>> Hi, 
>
>Hi,
>
>> is there a possibility to put a value of int variable as a text of GtkLabel. I tried to do it
>> in that way:
>> 
>> int var = 100;
>> char* buf[11];
>> sprintf(buf, "%i%c", var, 0);
>> gtk_label_set_text(gtk_label, buf);
>> 
>> or with no null character sprintf(buf, "%i", 100).
>> 
>> Neither of them works. How can i do that?
>
>:)
>
>This mailing list is the wrong place for this sort of question, you need
>the gtk-list OR gtk-app-list. This list is about the development OF GTK+
>itself.
>
>In answer to your question, try:
>
>int var = 100;
>gchar *str;
>
>str = g_strdup_printf ("%d", var);
>gtk_label_set_text (label, str);
>g_free (str);
>
>- --
>Regards,
>Martyn
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.4.6 (GNU/Linux)
>Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
>iD8DBQFGazpcwpLEnE7M298RAlHHAJ9fE0tDQcjNCo3UzaC7ZRYNswJ8LACfTqPg
>FGHmvXEIZDjfdEvayk1ne80=
>=HgOM
>-----END PGP SIGNATURE-----
>
Yeah, right
Sorry about that.

Thanks for your reply.



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