Understanding unix/linux Programming-stty Instruction Exercise

Source: Internet
Author: User

Let's start with a simple practice procedure:

1#include <stdio.h>2 3 intMain ()4 {5     intC, n =0 ;6      while((c = GetChar ())! ='Q' )7printf"Char%3d is%ccode%d\n", n++, C, c);8     return 0 ;9}

This is the program after the compilation of the effect of running, you can see after entering hello after hitting enter to run the program, that is, the characters entered in the terminal is actually buffered.

In addition, the ENTER key itself is recognized as a newline, and is also recognized by the program, which is also related to the terminal settings.

The TTY driver contains many operations on the data:

    1. Input: How the driver handles characters from the terminal
    2. Output: How the driver handles characters flowing to the terminal
    3. Control: How characters are represented--the number of bits, the parity of bits, the stop bit, etc.
    4. Local: How the driver handles characters from inside the driver

Writing terminal drivers: about system call functions:

Understanding unix/linux Programming-stty Instruction Exercise

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.