Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to pass user input from gtk to a function ?

42 views
Skip to first unread message

MrNEtBomber

unread,
May 20, 2013, 6:55:00 PM5/20/13
to
i want to pass a user input from gtk input box to a function ... i made code below but i had segmentation errors ...so after looking it up i discovred that the line -> "g_signal_connect(but,"clicked",G_CALLBACK(encode(tx1,tx2)),NULL);"
doesnt make a sense so can you help me do it .

this is program source =>

.....
//gets the first argument(buf)
tx1=gtk_entry_get_text(GTK_ENTRY(entry));
...
//gets the second argument(pass)
tx2=gtk_entry_get_text(GTK_ENTRY(entry));
....
//signal to callback funtion encode when button clicked
g_signal_connect(but,"clicked",G_CALLBACK(encode(tx1,tx2)),NULL);
...
//convert const char* to char*
char* ret (const char *bd){
char *c = new char[12];
strcpy(c,bd);
return c;
}
//encode function
char encode(const char ebuf[],const char epass[]) {
//this is what i only wrote and still having the error.
char *buf=ret(ebuf);
char *pass=ret(epass);
}

red floyd

unread,
May 20, 2013, 7:10:11 PM5/20/13
to
On 5/20/2013 3:55 PM, MrNEtBomber wrote:
> i want to pass a user input from gtk input box to a function ... i made code below but i had segmentation errors ...so after looking it up i discovred that the line -> "g_signal_connect(but,"clicked",G_CALLBACK(encode(tx1,tx2)),NULL);"
> doesnt make a sense so can you help me do it .
>

GTK is not a topic for this group. Did you have a question about the
C++ language?

> this is program source =>
> [redacted]

You have an error on line 42 of your code. Since many of us do not
know GTK, and none of us know what the context of your snippet is,
we can't help you... we're not psychic.

Provide a minimal compilable example that that exhibits the behavior
in question.

Also, find a group that is more on topic for this question.



MrNEtBomber

unread,
May 20, 2013, 7:16:32 PM5/20/13
to

i already did this ...but i ddin't find groups matching to what i want

Geoff

unread,
May 20, 2013, 8:22:53 PM5/20/13
to
On Mon, 20 May 2013 16:16:32 -0700 (PDT), MrNEtBomber
<karim...@gmail.com> wrote:

>
>i already did this ...but i ddin't find groups matching to what i want

http://www.gtkforums.com/

red floyd

unread,
May 21, 2013, 1:07:08 PM5/21/13
to
On 5/20/2013 4:16 PM, MrNEtBomber wrote:
>
> i already did this ...but i ddin't find groups matching to what i want
>

I had a problem with my car, but the mechanic was closed. So I asked my
butcher because he uses a car.


0 new messages