Convert file *'s file descriptor to int type FD function: int fileno (File * tream)The file descriptor function for converting int FD file descriptors to file * is file * fdopen (int fd, const char * mode ). After mutual conversion, the two point to the same stream. If one of them is disabled, the other is also disabled. If you try to disable
Then an error is returned. For example, if the file * type is used, if fileno is called to obtain an int type, fclose () is called first to close the table. If close () is called, an error is returned.
In UNIX system calls, stdin is used for standard input description and stdout is used for standard output. stderr is used for standard errors. However, in some call functions, stdin_fileno is referenced to indicate standard input. Similarly, stdout_fileno is used for standard access and stderr_fileno is used for standard errors.
Their differences:
Stdin is of the file * type and belongs to the standard I/O, in <stdio. h>.
Stdin_fileno is a file descriptor and is a non-negative integer. It is generally defined as 0, 1, and 2. It belongs to the I/O without buffer and directly calls the system call in <unistd. h>.