Understanding Unix/linux programming-files, devices, and streams

Source: Internet
Author: User
Tags function prototype numbers to roman numerals

Each device file supports system invoke IOCTL:

    • Goal: Control a device
    • Header files: #include <sys/ioctl.h>
    • Function prototype: int result = IOCTL (int fd, int operation [, Arg ...]);
    • Parameters
      • FD: File descriptor associated with file
      • Operation: Type of operation
      • ARG: Optional parameter
      • Result:-1 is wrong; 0 is correct;

In fact, the source or destination of any data is treated by UNIX as a file, and basic system calls support both disk files and device files. Their differences are reflected in the operation of the connection . The file descriptor of the disk file contains the definition code for the buffered and extended properties, and the terminal's file descriptor contains the definition code for edit, Echo, character conversion, and other operations.

Yes, you can. Each process step is considered a property of a connection, or a connection can be considered a combination of processing steps.

An important feature of the underlying data flow model is the modularity of the processing, which can be designed to install a module that converts numbers to Roman numerals if it is not satisfied with only supporting terminal drivers such as the case conversion.

In addition, Unix/linux programming practice looked at about 150 pages, although just follow the book to write the existing code, not to do more practice, but still feel that the understanding of the system deepened a lot ah, after the book to Ken operating system, ha ha, do not know the order has been reversed.

Understanding Unix/linux programming-files, devices, and streams

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.