read() 和 fread() 有什么区别? [英] What is the difference between read() and fread()?
本文介绍了read() 和 fread() 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在阅读 linux 工具 badblocks 的源代码.他们在那里使用 read()
函数.与标准的 C fread()
函数有区别吗?(我没有将参数视为差异.)
I'm reading source code of the linux tool badblocks. They use the read()
function there. Is there a difference to the standard C fread()
function? (I'm not counting the arguments as a difference.)
推荐答案
read()
是一种低级别的无缓冲读取.它在 UNIX 上进行直接系统调用.
read()
is a low level, unbuffered read. It makes a direct system call on UNIX.
fread()
是 C 库的一部分,提供缓冲读取.它通常通过调用 read()
来实现,以填充其缓冲区.
fread()
is part of the C library, and provides buffered reads. It is usually implemented by calling read()
in order to fill its buffer.
这篇关于read() 和 fread() 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文