是什么标准输入和STDIN_FILENO之间的区别? [英] What is the difference between stdin and STDIN_FILENO?
本文介绍了是什么标准输入和STDIN_FILENO之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么实际的区别,如果有的话,之间的标准输入
和 STDIN_FILENO
用C?
What is the practical difference, if any, between stdin
and STDIN_FILENO
in C?
推荐答案
的接口。像其他人一样说,标准输入
是 FILE *
由标准C库定义。你可以使用一些更高级别的接口,如 FREAD
, FWRITE
和 fprintf中
。在另一方面, STDIN_FILENO
只是一个文件描述符(几乎可以肯定,0)。这将使用略微低级别接口,通过的喜欢读
和写
。
The interface. Like everyone else has said, stdin
is a FILE *
as defined by the standard c library. You can use some of the higher level interfaces like fread
, fwrite
, and fprintf
. On the other hand, STDIN_FILENO
is just a file descriptor (almost certainly 0). This uses a slight lower level interface through the likes of read
and write
.
这篇关于是什么标准输入和STDIN_FILENO之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文