Re: I'm have a troubles with dynamic data strcutures
- From: Claudio Bley <bley cs uni-magdeburg de>
- To: "Alphex K." <alphex crew org ru>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: I'm have a troubles with dynamic data strcutures
- Date: Thu, 22 Jan 2004 19:52:26 +0100
Hi Alphex,
On Thu, Jan 22, 2004 at 11:22:27PM +0300, Alphex K. wrote:
aphone=gtk_entry_get_text(GTK_ENTRY(phoneentry));
anotes=gtk_entry_get_text(GTK_ENTRY(notesentry));
clients=AddClient(clients,aid,aname,amainsname,aemail,
aaddress,aoffaddress,aicq,ainn,aphone,
astatus,anotes);
/*debug1*/ //free(aname);
Where I have a mistake,
integers in structure work normally, but
I'm have a problem with pointers to char
Read the documentation about gtk_entry_get_text:
,----
| gtk_entry_get_text ()
|
| G_CONST_RETURN gchar* gtk_entry_get_text (GtkEntry *entry);
|
| Retrieves the contents of the entry widget. See also gtk_editable_get_chars().
|
| entry : a GtkEntry
|
| 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.
`----
I.e. you need to duplicate (g_strdup) the string returned by that
function if you want to store it in your structure. Remember to
(g_)free it later.
--
Claudio Bley ASCII ribbon campaign (")
Debian GNU/Linux user - against HTML email X
http://www.cs.uni-magdeburg.de/~bley/ & vCards / \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]