----- Original Message ----- From: "Marvin Humphrey" <[EMAIL PROTECTED]> To: "Sisyphus" <[EMAIL PROTECTED]> Cc: "xs" <perl-xs@perl.org> Sent: Tuesday, April 04, 2006 12:24 PM Subject: Re: FILE* to PerlIO*
> > 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) ); Aaah ... thanks for that. (It doesn't answer the question I asked, but it answers the question I *meant* to ask :-) > > Try this as a demo: > . . > void c_write(PerlIO * writer) { > PerlIO_write(writer, "hello world\n", 12); > } . . Heh ... I had tried that, but it wouldn't compile. I forget the actual error I got, but it looked like a syntax error. However, on close visual inspection of the code I had written (it was only 3 lines !!) I couldn't spot a syntax error and decided that passing a PERLIO* to XS simply must not be allowed. Well .... it must have been some silly syntax error after all, because it works fine, of course :-) Thanks, Marvin. Cheers, Rob