[英]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. 我正在使用一个lexer接受
FILE*
对象来读取数据。 I'd like to be able to pass it POSIX file descriptors (ie stuff you get from open
, pipes, etc.). 我希望能够传递POSIX文件描述符(即你从
open
,管道等获得的东西)。
How can I turn a POSIX file descriptor into a FILE*
? 如何将POSIX文件描述符转换为
FILE*
?
在任何符合POSIX的系统上,使用fdopen()
。
在<stdio.h>
使用fdopen(3)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.