简体   繁体   English

在Mac OS X上,如何将POSIX fd转换为文件*?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM