开发者

C : how can I change from file descriptor to FILE struct and vice versa?

开发者 https://www.devze.com 2023-01-26 04:23 出处:网络
Is there any way to change an int file descriptor to a FIL开发者_运维技巧E struct pointer or/and change FILE* to a file descriptor in C?The function fdopen() returns a new (FILE *) associated with an

Is there any way to change an int file descriptor to a FIL开发者_运维技巧E struct pointer or/and change FILE* to a file descriptor in C?


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

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


Use "fileno()" for FILE->int.

Use "fdopen()" for int->FILE.

0

精彩评论

暂无评论...
验证码 换一张
取 消