用C最快的文件阅读 [英] Fastest file reading in C

查看:119
本文介绍了用C最快的文件阅读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我用的fread()读取文件,但在其他语言FREAD()是低效的心中已经被告知。这是在C一样吗?如果是这样,怎么会更快的文件阅读办?

Right now I am using fread() to read a file, but in other language fread() is inefficient i'v been told. Is this the same in C? If so, how would faster file reading be done?

推荐答案

如果你愿意超越的C规格到OS具体code,内存映射被普遍认为是最有效的方式。

If you are willing to go beyond the C spec into OS specific code, memory mapping is generally considered the most efficient way.

对于POSIX,看看 MMAP 和Windows检查 OpenFileMapping

For Posix, check out mmap and for Windows check out OpenFileMapping

这篇关于用C最快的文件阅读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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