Stdio and stdin_fileno

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.