Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-18 19:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found