C:如何从文件描述符更改为FILE结构,反之亦然? [英] C : how can I change from file descriptor to FILE struct and vice versa?

查看:52
本文介绍了C:如何从文件描述符更改为FILE结构,反之亦然?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以将 int 文件描述符更改为 FILE 结构指针,或者将 FILE * 更改为文件描述符C?

Is there any way to change an int file descriptor to a FILE struct pointer or/and change FILE* to a file descriptor in C?

推荐答案

函数 fdopen()返回与打开的文件描述符关联的新(FILE *).

The function fdopen() returns a new (FILE *) associated with an open file descriptor.

函数 fileno()返回与打开的FILE *相关的​​文件描述符.

The function fileno() returns the file descriptor associated with an open FILE *.

这篇关于C:如何从文件描述符更改为FILE结构,反之亦然?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆