On Apr 3, 2006, at 6:46 PM, Sisyphus wrote:
Hi,
I guess the succinct way of asking the question is "how do I
convert from a
FILE* to a PerlIO* ?".
Not sure, but you can open a filehandle in Perl, then get a PerlIO*
out of the scalar like so:
PerlIO *reader = IoIFP( sv_2io(input_filehandle_sv) );
PerlIO *writer = IoOFP( sv_2io(output_filehandle_sv) );
Try this as a demo:
---------------------
use warnings;
use Inline C => Config =>
BUILD_NOISY => 1;
use Inline C => <<'EOC';
void c_write(PerlIO * writer) {
PerlIO_write(writer, "hello world\n", 12);
}
EOC
my $data = '';
open( $wr, '>', \$data ) or die "Opening \$wr: $!";
c_write($wr);
close $wr or die "Closing \$wr: $!";
print $data;
---------------------
Marvin Humphrey
Rectangular Research
http://www.rectangular.com/