in reply to converting perl file handle into C FILE *

If you're using PerlIO instead of STDIO, you probably won't be able to do what you want, because the buffer layout is likely incompatible.

If all you want is a FILE * that is open on the same filedescriptor (which means that buffered I/O will almost certainly be broken), you can get the fileno from Perl, then create a FILE * on that using fdopen(3). That's probably not very safe though, because Perl will eventually close the handle leaving your FILE * pointing at a dead handle.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on Re: converting perl file handle into C FILE *