Re: how to get a vector from a function?(please help)



You should use
******************* function***************
char *gchtxt (GtkWidget *entry, char *tmp){

tmp = gtk_editable_get_chars (GTK_EDITABLE(entry), 0, -1);
        /*tmp=(char*)malloc(strlen(tmp)*sizeof(char));*/
printf ("This is my text %s\n", tmp);
         return (tmp);

*************main**************
gchar *v
v=gtk_signal_connect_object (GTK_OBJECT (button1), "clicked",
                             GTK_SIGNAL_FUNC (gchtxt),entry1);
printf("%s\n",v)

Bye
Amit Jain.

----- Original Message -----
From: "Mauro Venanzi" <jjfnet libero it>
To: "listagtk" <gtk-list gnome org>
Sent: Monday, December 02, 2002 10:56 AM
Subject: how to get a vector from a function?(please help)


Hi
i have a function that get  the text from a  entry
the text is pushed in a vector
the function turns back the vector and so the text
but if i try to do a printf in yłthe main program it segfauls

how can i do?

here is the code ( part)

******************* function***************
char gchtxt (GtkWidget *entry, char *tmp){

tmp = gtk_editable_get_chars (GTK_EDITABLE(entry), 0, -1);
        /*tmp=(char*)malloc(strlen(tmp)*sizeof(char));*/
printf ("This is my text %s\n", tmp);
         return (tmp);

*************main**************
gchar *v
v=gtk_signal_connect_object (GTK_OBJECT (button1), "clicked",
                             GTK_SIGNAL_FUNC (gchtxt),entry1);
printf("%s\n",v)

-i try also -
gtk_signal_connect_object (GTK_OBJECT (button1), "clicked",
                             GTK_SIGNAL_FUNC (gchtxt (entry1,v)),entry1);
the same

thanks and hope in  help
regards


----
*************************************************************
                      Universe Creation
 ....and God wrote:
                      tar -Uvh BigBeng.tar.gz
#############...unpacking..######################
*************************************************************
Mauro Venanzi linux ru250233
hall2001 athlon-xp rm 135009 on Suse 8.1


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





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