Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

RE: (Guildenstern) RE: RE (tilly) 1: Creating a file with Open

by ncw (Friar)
on Oct 03, 2000 at 23:46 UTC ( [id://35175]=note: print w/replies, xml ) Need Help??

in reply to (Guildenstern) RE: RE (tilly) 1: Creating a file with Open
in thread Creating a file with Open

Opening the file "+>" will wipe it out, so flocking it is then pretty pointless - you destroy the file before you've gained the lock on it.

You need to open the file "+<", if that failed then open it "+>" then flock it then truncate it if you want to be safe with your flocking in the presence of other readers.

Note that if you want to read the file back in with flocking you need to use "+<" so that you open the file with write intent otherwise the flocking may not work properly (I don't understand the reasons for this but that is what it says in the man pages!)

  • Comment on RE: (Guildenstern) RE: RE (tilly) 1: Creating a file with Open

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://35175]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-05-21 09:31 GMT
Find Nodes?
    Voting Booth?

    No recent polls found