Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!spool.mu.edu!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.lang.c Subject: Re: file descriptor vs file handle Message-ID: <1991Feb26.160043.28096@athena.mit.edu> Date: 26 Feb 91 16:00:43 GMT References: <90361.145855COS99291@ufrj.bitnet> <27C9CB35.5F7@wilbur.coyote.trw.com> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 27 In article <27C9CB35.5F7@wilbur.coyote.trw.com>, cwong@charlie.coyote.trw.com (Chun Wong) writes: |> Can someone distinguish the differences between a file descriptor and |> a file handle? I know that creat returns a file handle whereas fopen |> returns a file descriptor. What's the difference? Are they interchangeable? First of all, creat is obsolete. :-) Second, creat returns a file descriptor, not a file handle. If your manual claims that it returns a file handle, then it's out-of-date. The reason I say "out-of-date" instead of "wrong" is that I have heard file handle and file descriptor used interchangeably in the past, but it's probably a bad idea to use them that way nowadays, becavuse "file handle" has taken on a very different meaning in some circles. For example, the NFS people use the term "file handle" to refer to the widget used to represent a particular file on an NFS server in communications between NFS servers and NFS clients. Hence you might get the error "stale NFS file handle" if you cd into an NFS directory on a client machine, then delete the directory on the server, then try to do a "pwd" or other operation on the directory in the client. -- Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710