Perl & XS -- Modifying a char*

Discussion in 'Perl' started by Shawn Zabel, Jul 19, 2004.

  1. Shawn Zabel

    Shawn Zabel Guest

    I'm looking for suggestions on how to modify a char* argument passed into an
    XS function. It's been two days now that a co-worker and I have been trying
    to figure this out. We've seen examples on how to modify integers, but
    nothing on strings or char pointers. The example below is meant only to
    provide a crude example of what we are trying to accomplish. We are very
    appreciative of any and all help provided of this issue.


    ***Example Perl Code***
    my $p = "old value";

    getLastPrompt($p);
    or
    getLastPrompt(\$p);

    $p now equals "new prompt"


    ***Example XS Code***
    int getLastPrompt(prompt)
    char * prompt
    CODE:
    prompt = "new prompt";
    RETVAL = 1;
    OUTPUT:
    prompt
    RETVAL


    - Shawn
     
    Shawn Zabel, Jul 19, 2004
    #1
    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. wwj
    Replies:
    7
    Views:
    558
  2. wwj
    Replies:
    24
    Views:
    2,521
    Mike Wahler
    Nov 7, 2003
  3. Ben Pfaff
    Replies:
    5
    Views:
    480
    Tristan Miller
    Jan 17, 2004
  4. Steffen Fiksdal

    void*, char*, unsigned char*, signed char*

    Steffen Fiksdal, May 8, 2005, in forum: C Programming
    Replies:
    1
    Views:
    590
    Jack Klein
    May 9, 2005
  5. lovecreatesbeauty
    Replies:
    1
    Views:
    1,063
    Ian Collins
    May 9, 2006
Loading...

Share This Page