Knowing if a file descriptor is open

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jorba101
    New Member
    • Jun 2008
    • 86

    Knowing if a file descriptor is open

    Is there any way, using fcntl() to know whether a filedescriptor is open or closed (*NIX environment)
  • ashitpro
    Recognized Expert Contributor
    • Aug 2007
    • 542

    #2
    Can't you use select() system call?
    If you pass the closed file descriptor as parameter it will return the -1 indicating the error. And errno will be set to EBADF

    Regards,
    Ash

    Comment

    Working...