In article <news:ck**********@gist.usc.edu>
Rookie <do***********@rediffmail.com> wrote:
Ex. Suppose a parent forks two children A and B and both have file pointers
initialized to the start of the same file by the parent.
In comp.lang.c, we do not have fork(). :-)
If process A was reading from the start of file to say a point X
in the file and now if process B starts executing and reads from the
same file, will B's copy of the file pointer point to the start of
the file or will it point to X?
In comp.unix.programmer, we have POSIX, which says that if the
underlying file descriptor is shared, so is the seek offset. If
only the file (not the descriptor) is shared, the seek offsets are
independent. The dup(), dup2(), and fork() calls all share the
file descriptor. Separate open()s do not.
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it
http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.