safe simultaneous file append?
Dale Strickland-Clark
dale at riverhall.NOSPAMco.uk
Mon Oct 8 06:21:54 EDT 2001
piet at cs.uu.nl wrote:
>>>>>> Dale Strickland-Clark <dale at riverhall.NOSPAMco.uk> (DS) writes:
>
>DS> Yes. You can't append to a file from two different places at once. You
>DS> have a few choices:
>
>In fact in modern Unixes you *CAN*.
>From man fopen:
>
> Opening a file with append mode (a as the first character in
> the mode argument) causes all subsequent writes to the file
> to be forced to the then current end-of-file, regardless of
> intervening calls to fseek(3S). If two separate processes
> open the same file for append, each process may write freely
> to the file without fear of destroying output being written
> by the other. The output from the two processes will be
> intermixed in the file in the order in which it is written.
Erk! There's a recipee for disaster unless treated very carefully.
Handy if you're careful, though, I guess.
--
Dale Strickland-Clark
Riverhall Systems Ltd
More information about the Python-list
mailing list