1. stdio
2. stdin_fileno Inconsistent data types:
The stdin type is file *, pointing to a struct pointer. It belongs to the standard I/O and is implemented by the Standard C library. It is an advanced input function, which is defined in the standard library <stdio. h>.
The stdin_fileno type is int. It is the file descriptor ( File APIs provided at the operating system level are all represented by file descriptors. file descriptors are proprietary concepts of Linux kernel, and operations on file descriptors are system calls. Stdin_fileno is the file descriptor of the standard input device (usually the keyboard ). ) Is a non-negative integer that opens the file handle. It is an I/O without a buffer and can directly call the system call and define
/Usr/include/unistd. h. Code:
/* Standard file descriptors .*/
# Define stdin_fileno 0/* standard input .*/
# Define stdout_fileno 1/* standard output .*/
# Define stderr_fileno 2/* standard error output .*/
Inconsistent levels:
Stdio is an input stream processed by the standard library (User-layer C library). stdin functions are mainly called by standard libraries such as fread, fwrite, and fclose, the standard library encapsulates system API calls.
Stdin_fileno is a system api library (system call at the system layer). stdin_fileno functions include system-level function calls such as read, write, and close.