
airman
Deleted
Mar 14, 2001, 2:19 PM
Post #1 of 2
(292 views)
|
I am trying to open a file, flock it, read it and then write to it. I am trying to do both the read and write under one flock so that there is no possiblility of someone opening the file between the read and write. The following works fine: open(INFILE, "file.htm"); flock(INFILE, 1); @lines=<INFILE>; close(INFILE); open(OUTFILE, "+>$file.htm"); flock(OUTFILE, 2); print OUTFILE "stuff"; close(OUTFILE); The following does NOT work open(OUTFILE, ">$file.htm"); flock(OUTFILE, 2); @lines=<OUTFILE>; print OUTFILE "stuff"; close(OUTFILE);
|