How to pass user input from gtk to a function ?

M

MrNEtBomber

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);
}
 
R

red floyd

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.
 
R

red floyd

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top