RE: GtkEntry problem
- From: "Tom Liu" <tom liu flextrade com>
- To: "'Amandip'" <asangh-1 broadpark no>, "'Harring Figueiredo'" <harringf yahoo com>, <gtk-app-devel-list gnome org>
- Subject: RE: GtkEntry problem
- Date: Fri, 17 Oct 2003 13:47:12 -0400
char str[10000];
strcpy(str, gtk_entry_get_text(_entry));
// make your change to str;
gtk_entry_set_text(_entry,str);
this should works.
-----Original Message-----
From: gtk-app-devel-list-admin gnome org
[mailto:gtk-app-devel-list-admin gnome org] On Behalf Of Amandip
Sent: Friday, October 17, 2003 1:43 PM
To: Harring Figueiredo; gtk-app-devel-list gnome org
Subject: Re: GtkEntry problem
Hi, thank you for your help, but I still cannot get the application to
work!
The thing is, that I am parsing the string my_str (gotten from
gtk_entry_get_text) using strtok. And strtok is obviously known to mess
up its argument-string. But my parsing-routine is working good when I
give it strings recieved from scanf etc. And it crashes only when I give
it a string gotten from gtk_entry_get_text (in the callback function of
a GtkEntry-field). The error that occurs seem to be memory related
(malloc etc.)
Can you think of any thing that might be causing this?
Thank you very much,
Amandip
Harring Figueiredo wrote:
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
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]