Can anybody tell me what are file descriptors in C?? I searched the net but can't clear my concepts!!!

11 Years
Discussion Span
Last Post by mostafadotnet

In UNIX-like systems, a file descriptor is a small integer associated with an open file stream. You can use procedures like read and write to read and write to a particular file stream, and in order to do this, you need to provide the file descriptor for the open file you want written to. The procedure open is used to open files, and it returns the integer that should be used as the file descriptor (or in case of error, returns -1).

The standard C library, with procedures like fopen, fread, and fwrite uses 'FILE pointers', pointers of type FILE*, to refer to open files.

I don't know what Windows uses for OS-specific input/output.


Hi himanjim,
These functions(read,write,close,...) are called system calls which are kernel-level file manipulation.
Inorder to get information on linux system calls,search google for

Advanced Linux Programming

It would be found in PDF format easily.
I have a project for this purpose.Tell me if you want the source code.

Good luck.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.