Home  |  Linux  | Mysql  | PHP  | XML
From:Nicholas Clark Date:Thu Jul 31 04:37:15 2008
Subject:Re: Allocating a char* and returning to Perl from a C function
On Thu, Jul 31, 2008 at 11:30:27AM +0100, Paulo Filipe Andrade wrote:

> I was thinking of something in the line of creating an SV of type pv  
> right away, and then using sv_2pvbyte_nolen to get the buffer.
> I think this should work, but I can't find a newSVpv function that  
> allows me to specify the string length I want without passing in a  
> char *.
> 
> Any other suggestions?

Try newSV()

You'll need to use SvCUR_set() and SvPOK_on() once you're done to record
the length of the data in the PV buffer, and that the PV buffer is valid.

Nicholas Clark
Navigate in group perl.inline at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants