Perl & XS -- Modifying a char*

S

Shawn Zabel

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
 

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,774
Messages
2,569,599
Members
45,170
Latest member
Andrew1609
Top