[Glade-users] How To Send Array Element To Label?
- From: tvb at gnome.org (Tristan Van Berkom)
- Subject: [Glade-users] How To Send Array Element To Label?
- Date: Wed Nov 9 14:57:11 2005
Bob Jones wrote:
I have an array:
char array1[] = "abcdefg";
o array1 here is a null terminated charachter array
(in other words a string);
o array1[3] is a charachter in an array (a short intager describing
the ascii code for; in this case; the letter "d").
o gtk_label_set_text () takes a "string" as a second argument.
if you call it like so:
gtk_label_set_text (label, &array[3]); // (note the &)
then the label should display the string "defg".
if you only want to show the letter "d", then you'll need to make a
string; something like:
char *string = g_strdup_printf ("%c", array[3]);
gtk_label_set_text (label, string);
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]