与fwrite和fread相比,pwrite和pread有何优势? [英] What are the advantages of pwrite and pread over fwrite and fread?

查看:109
本文介绍了与fwrite和fread相比,pwrite和pread有何优势?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,请问我问的是小问题,请介意.

Hey please don't mind if I am asking trivial question, but, please can somebody help me with this..

推荐答案

当您执行大量随机读/写操作时,此功能很有用.SQLite3甚至还有一个选项可以替换 seek() + read() seek() + write() pread()/pwrite().

It's useful when you do a lot of random read/write operations. There is even an option for SQLite3 that replaces seek() + read() and seek()+ write() with pread()/pwrite().

优点: seek() + read() seek() + write()都是一对系统调用,而 pread() pwrite()是单个系统调用.通常,一个普遍的事实是,系统调用程序的次数越少,它的效率就越高.

The advantage: seek()+ read() and seek() + write() both are the pairs of system calls while pread() and pwrite() are single system calls. It's usually an universal truth that the less system calls program issues the more efficient it is.

这篇关于与fwrite和fread相比,pwrite和pread有何优势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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