How to pass user input from gtk to a function ?

Discussion in 'C++' started by MrNEtBomber, May 20, 2013.

  1. MrNEtBomber

    MrNEtBomber Guest

    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);
    }
     
    MrNEtBomber, May 20, 2013
    #1
    1. Advertising

  2. MrNEtBomber

    red floyd Guest

    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.
     
    red floyd, May 21, 2013
    #2
    1. Advertising

  3. MrNEtBomber

    MrNEtBomber Guest

    i already did this ...but i ddin't find groups matching to what i want
     
    MrNEtBomber, May 21, 2013
    #3
  4. MrNEtBomber

    Geoff Guest

    On Mon, 20 May 2013 16:16:32 -0700 (PDT), MrNEtBomber
    <> wrote:

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


    http://www.gtkforums.com/
     
    Geoff, May 21, 2013
    #4
  5. MrNEtBomber

    red floyd Guest

    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.
     
    red floyd, May 21, 2013
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    522
  2. Tricky
    Replies:
    0
    Views:
    579
    Tricky
    Mar 19, 2009
  3. Gergely Kontra
    Replies:
    2
    Views:
    251
    Joao Pedrosa
    Jun 18, 2004
  4. Alex Shulgin
    Replies:
    1
    Views:
    180
    thefed
    Nov 21, 2007
  5. Susan Cranford
    Replies:
    2
    Views:
    403
Loading...

Share This Page