On Mac OS X, how do I turn a POSIX fd into a FILE*?
I'm working with a lexer that accepts FILE*
objects to read data from. I'd like to be able to pass it POSIX 开发者_开发知识库file descriptors (i.e. stuff you get from open
, pipes, etc.).
How can I turn a POSIX file descriptor into a FILE*
?
On any POSIX-compliant system, you use fdopen()
.
Use fdopen(3)
in <stdio.h>
.
精彩评论