Re: gtk_entry_get_text() - having problems with return type
On Wed, 2003-03-05 at 01:16, Raymond Wan wrote: Hi, On Wed, 5 Mar 2003, Ben LeMasurier wrote: warning: assignment makes pointer from integer without a cast gethostbyname() requests a char * and gtk_entry_get_text() returns G_CONST_RETURN gchar* According to the glib docs, a G_CONST_RETURN gchar* is typedef'ed to a char* (See glib, basic types in the docs). But, as it stresses in the gtk_entry_get_text (), you shouldn'tfree, modify, or store it. I think I malloc'ed a temporary variable of type char * and did a strcpy and that worked fine. Just don't try storing it with an assignment... What I normally do is use g_strdup (), eg: gchar *name; GtkWidget *name_entry; name = g_strdup (gtk_entry_get_text(GTK_ENTRY(name_entry))); g_print (The name was: %s\n, name); g_free (name); Keith. ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk_entry_get_text() - having problems with return type
Hi, On Wed, 5 Mar 2003, Ben LeMasurier wrote: warning: assignment makes pointer from integer without a cast gethostbyname() requests a char * and gtk_entry_get_text() returns G_CONST_RETURN gchar* According to the glib docs, a G_CONST_RETURN gchar* is typedef'ed to a char* (See glib, basic types in the docs). But, as it stresses in the gtk_entry_get_text (), you shouldn'tfree, modify, or store it. I think I malloc'ed a temporary variable of type char * and did a strcpy and that worked fine. Just don't try storing it with an assignment... Ray ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk_entry_get_text() - having problems with return type
Well, I tried to do an strcpy() on the string but I am still getting a segfault when I try to access it, I also get the same compile time error as before - I don't understand why it is telling me assignment makes pointer from an integer either. better get the coffee out, this might be a long night for me. thanks, Ben Hi, On Wed, 5 Mar 2003, Ben LeMasurier wrote: warning: assignment makes pointer from integer without a cast gethostbyname() requests a char * and gtk_entry_get_text() returns G_CONST_RETURN gchar* According to the glib docs, a G_CONST_RETURN gchar* is typedef'ed to a char* (See glib, basic types in the docs). But, as it stresses in the gtk_entry_get_text (), you shouldn'tfree, modify, or store it. I think I malloc'ed a temporary variable of type char * and did a strcpy and that worked fine. Just don't try storing it with an assignment... Ray _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list