in reply to Re: Difference between File Handles and File Descriptors in function parameters.
in thread Difference between File Handles and File Descriptors in function parameters.

thanks for your response, So what exactly is a file descriptor?? somehow I find that no page I found really answers that question, they just talk about how to use it. Why would any one want to pass or return a file descriptor?
  • Comment on Re^2: Difference between File Handles and File Descriptors in function parameters.

Replies are listed 'Best First'.
Re^3: Difference between File Handles and File Descriptors in function parameters.
by TomDLux (Vicar) on Aug 11, 2011 at 15:20 UTC

    A file descriptor is a number which specifies a IO stream. In Unix and other POSIX environments, there is an array called the file descriptor table, and you can use a number which indexes one of those entries: 0 is STDIN, 1 is STDOUT, 2 is STDERR ... the remainder you open yourself.

    See Wikipedia's explanation.

    As Occam said: Entia non sunt multiplicanda praeter necessitatem.

Re^3: Difference between File Handles and File Descriptors in function parameters.
by jethro (Monsignor) on Aug 11, 2011 at 15:21 UTC

    A file descriptor is just a number local to your program, in effect enumerating your open files. Well known file descriptors are 0 (usually pointing to STDIN), 1 (STDOUT) and 2 (STDERR)

    I don't see any advantage in this case, but I'm no expert on this. Maybe it was a miscomunication and he just meant to use $fd filehandles instead of FD filehandles!?