Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^4: How do I tell if a handle is open for writing?

by DrWhy (Chaplain)
on Nov 08, 2005 at 14:17 UTC ( #506744=note: print w/replies, xml ) Need Help??


in reply to Re^3: How do I tell if a handle is open for writing?
in thread How do I tell if a handle is open for writing?

Ah. That looks much more to the point :) I like this fcntl()-based solution better than sgifford's solution (print nothing) because it more directly answers the question at hand. Which is not to say that sgifford's solution is bad; it has the advantage that it will catch some writability problems not related to how the handle was opened, plus it looks less complex to the human reader of your code.

Unfortunately, I'm doing this on Win32 :( Win32 doesn't implement the fcntl() function, so I'll go with the 'print nothing' solution for now.

--DrWhy

"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."

  • Comment on Re^4: How do I tell if a handle is open for writing?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://506744]
help
Chatterbox?
[Corion]: 1nickt: No, I'm using it with Windows 10, but with the 4k display, yes. It's a very nice build IMO, and relatively sturdy. Also, it got 8 or 9 on the ifixit repair scale, which I consider good
[Corion]: ... especially as I expect to have to replace the battery set in two or three years' time
[1nickt]: Nice. So happy that Dells are still user-repairable. Unusual these days.
[1nickt]: I will certainly not be buying any more Macs.
[Corion]: 1nickt: Yeah, or at least, I hopoe so ;)

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2017-03-27 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.