Could someone help me to understand what File descriptors are in Linux?

Hey there,

Very basicly, it's an integer used to identy an open file in a process. In Unix/Linux/Posix 0, 1 and 2 are generally reserved for STDIN (standard input), STDOUT (standard output) and STDERR (standard error), in that order.

The integer (of file descriptor) are required as arguments to read, write and close operations. The integer, itself, is created by an open operation.

Best wishes,

Mike

To detail on this, in Unix-based systems, all the open file handles are stored in an array internal to the system. The file descriptor so returned is the index of the array position where the file handle is stored.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.