Le dimanche 21 juin 2009 14:20:17, David Nečas a écrit :> On Sun, Jun 21, 2009 at 02:13:52PM +0200, Julien Martin wrote:> > *static void hello(GtkWidget *widget, gpointer data) {> > gchar * _data = (gchar *) data; There is no need to cast a gpointer. > > g_print(_data); Same as David, never put a variable for the format of printf like functions, always use %s e.g. fooprintf("%s", variable). Mike > > g_print("\n");> > }*> >> > wich I call as follows:> > *> > g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(hello), "hello> > toto");*> >> > I get the following warning each time I compile:> >> > *warning: the format is not a litteral string and no format argument*> >> > Can anyone please help?> > I need to "cast" the data variable to gchar *. What am I doing wrong?>> The problem is not in the typecasting. The problem is that if you do> (directly or indirectly)>> g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(hello), "%s");>> your program will crash. Print the message as>> g_print("%s\n", data);>> Yeti>> _______________________________________________> gtk-list mailing list> gtk-list@xxxxxxxxx> http://mail.gnome.org/mailman/listinfo/gtk-list _______________________________________________gtk-list mailing listgtk-list@xxxxxxxxxxxxx://mail.gnome.org/mailman/listinfo/gtk-list