Re: GtkEntry problem




  char* my_str = g_strdup(gtk_entry_get_text(_entry));

  // Make SURE you free my_str after you are done

Harring

--- Amandip <asangh-1 broadpark no> wrote:
Hi,

I'm writing an application which needs some text-input from a little 
GtkEntry (about 10 chars). After I retrieve this string of characters 
(with gtk_entry_get_text placed in a callback-function), I pass thiss 
string on to another function, which I have written, for further 
processing etc...
The problem is obviously that gtk_entry_get_text returns

" a pointer to the contents of the widget as a string. This string 
points to internally allocated storage in the widget and must not be 
freed, modified or stored."

so this causes my application to crash, because I try to modify this 
string.

How can I retrieve the contents from a GtkEntry-field, and store and 
modify the contents as I see fit?

Appreciate any help,
thanks,
Amandip

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com



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