What is the difference between read and pread in unix?

前端 未结 4 2104
孤城傲影
孤城傲影 2020-12-13 06:59

What is the difference between the functions read() and pread() in unix?
When choosing between them, what points should I take into considerati

4条回答
  •  余生分开走
    2020-12-13 07:14

    read() starts reading the requested number of bytes from the current file offset whereas with pread(), you can specify the offset. This is useful in situations where one set of functions is reading through a file sequentially using the file pointer while another set is accessing specific data at the same time.

提交回复
热议问题