Le samedi 22 octobre 2005 à 10:54 -0200, Wilton a écrit : > Hi, I'm starting to program in C/GTK+ and I have a problem with a > variable. Let me show the code and the error: > > /*-- Global Variables --*/ > char query_string[256]; > GtkWidget *entry_sql; > . > . > . > > /*-- Do the instruction SQL --*/ > sprintf(query_string, entry_sql); // Build the instruction SQL > res = PQexec(conn, query_string); // Send the SQL to the database > > I need to pass the value in GtkWidget *entry_sql to the char > query_string[256] (a C variable), because when i compile it i receive > the following error: > > [Warning] passing arg 2 of `sprintf' from incompatible pointer type > > How can i solve this problem? The use of sprintf is dangerous since you might have a buffer overflow unless you are absolutely sure that the cpied string will never be that big. Anyway, assuming that entry_sql is a GtkEntry*, you can use : char const *query_sql; query_sql = gtk_entry_get_text (GTK_ENTRY (entry_sql)); ... _______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list