two file descriptors to same file

前端 未结 3 375
心在旅途
心在旅途 2020-12-08 08:16

Using the posix read() write() linux calls, is it guaranteed that if I write through one file descriptor and read through another file descriptor, in a serial fashion such t

3条回答
  •  臣服心动
    2020-12-08 09:05

    when you use dup() or dup2() or fork() , the file table is shared by both of the file descriptors. so if you write something from one file descriptor , and again write something through other file descriptor , then it is appended not overwritten.

    but if two independent process open one file , then the data written by both processes may get mixed.

提交回复
热议问题