What is a file descriptor? What are the file descriptors in Unix OS for stdin, stdout, and stderr, respectively?
Question:
What is a file descriptor?
What are the file descriptors in Unix OS for stdin, stdout, and stderr,
respectively?
Answer:
A file descriptor
is a handle represented by an integer that identifies an open file, pipe, or
socket that belongs to a process. The kernel maintains a table of file
descriptors that are used to reference open files and input/output (I/O)
streams.
In Unix, 0, 1, and
2 are reserved for standard input (stdin), standard output (stdout), and
standard error (stderr), respectively.
******************
Related Questions:
- What is a file descriptor? What are the file descriptors in Unix OS for stdin, stdout, and stderr respectively?
No comments:
Post a Comment