什么是read()和FREAD()之间的区别?
问题描述:
我在看的Linux工具 badblocks 来源$ C $ C。他们使用阅读()
函数那里。有没有标准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.)
答
阅读()为低电平,无缓冲读。这使得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.