Click to See Complete Forum and Search --> : gtk+ & C


vhg119
03-24-2001, 02:50 PM
what am i doing wrong?
here's part of the main()

char board[6][7];
....
gtk_object_set_data( GTK_OBJECT(button), "data", board);


as you can see, i declared a 2 dimensional char array named board. then i initialized it afterwards.. (replaced by ....).. then i set the data to my object button.
the problem arises when i try to retrieve the data. It works fine with one dimensional arrays and gtk objects.
inside called function:

void function( GtkWidget *widget, gpointer pdata) {
char sent[][7] = gtk_object_get_data( GTK_OBJECT(widget), "data");
}

when i try to compile the code, it keeps saying that its an invalid initializer.
this forced me to just make a global board[6][7] which i don't really want.
anybody?

[ 24 March 2001: Message edited by: vhg119 ]

Sterling
03-24-2001, 05:32 PM
I think you just need a cast on the return type of that gtk_get_widget_data function, to turn it from a pointer to a pointer to a pointer.