Re: [gtk-list] problems with gtk_entry_get_text



On Sun, 31 May 1998, Travis Loyd wrote:

> The client I have so far is displaying to a Text Widget and taking user
> input from a Text Entry widget. Data entered by the user is changed to be
> readable by the server. The server wants 'CHAT TALK: <message>' so if the
> user types 'asdf' the server is sent 'CHAT TALK: <username>,asdf'

which is done through a string conversion?
where is that performed? in sendPacket()?
does sendPacket() care about not modifiing the string
that it got passed as argument?.

> void hit_enter(GtkWidget *widget, gpointer *data) {
>         gchar *string;
>         struct gui_info_hold *ptr;
> 
>         ptr = (struct gui_info_hold*)data;
>         string = gtk_entry_get_text(GTK_ENTRY(widget));
 +	  string = g_strdup (string);
>         g_print("User typed: %s\n", string);
>         sendPacket(ptr->host_info.sock, string);
 +	  g_free (string);
>         gtk_entry_set_text(GTK_ENTRY(widget), "");
> }

could you try that out please?

> 
> Travis Loyd

---
ciaoTJ



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