buffer to callback



I'm a newbie with a simple problem
I have defined a buffer in main()
When I press a button, I want it to do a 
callback and print this buffer out on the command line,
just so I can see that the strings are have arrived
in the callback.
I keep getting 'incompatible pointer type' for the fourth
argument of the button's gtk_signal_connect as a warning,
and sure enough, the compiled code prints out garbage.
I've tried every version of 'pointer type' I can think of
and it never works. Obviously, I don't know what I'm doing.
Could someone tell me how to get the buffer to print from
inside the callback?  Better yet, some example code
would really help.
 Here is some of my goofy code.

#include <stdio.h>
#include <gtk/gtk.h>
 
void callback(GtkWidget * widget, gpointer  buffer)
{
   int i;
   g_print("\nThis is the callback function.");
   for(i=0; i<6; i++)
     printf("buffer is %s",(char *) buffer[i] );
}

 In Main is this ( along with a lot of other stuff )

  static  char  buffer[6][12] = { "Yesterday","Today","Tomorrow",
               "Today + 2 ","Today + 3 ","Today + 4"};

   button = gtk_button_new_with_label("Change the Day");
   gtk_signal_connect_object(GTK_OBJECT(button), "clicked",
                             GTK_SIGNAL_FUNC(callback),
                              (gpointer) buffer );




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