Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
它实际上是逐个字符地读取,还是将一些字节读入内核缓冲区并逐个字符地返回给用户?
和 一样fgets吗?
fgets
让我说我使用 glibc 和 gcc 编译器。
几乎是对的。具有用户/内核分离的典型现代实现将字节存储在用户缓冲区中,而不是内核缓冲区中。因此,许多调用fgetc实际上触发了几个真正的系统调用。
fgetc