read()和fread()之间有什么区别? [英] What is the difference between read() and fread()?

查看:123
本文介绍了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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆