C Primer Plus Unit eighth-character input/output confirmation

Source: Internet
Author: User

This chapter is mainly about the concept of input and output streams and the simple application of input and output.

The concept that has been said:

• Buffer

When you use the console program to write a program, when you use the Input function to enter content, the input will always complete the input after you type the newline character \ n, and the final input will not be determined either by adding or changing the contents of the input. In the game or in the real-time key operation, any button, touch and mobile devices will immediately produce corresponding response. The two methods are buffered input and non-buffered input, respectively.

• redirect

For a computer, the form of input and output is not unique. Input can be from the keyboard, files, and perhaps also from what gravitational waves, short wave, medium wave, long wave, small cosmic chakra, the output of the purpose of equipment is also diverse. So it's too cumbersome and specific for the language standard, and it doesn't matter. For the C language, the language standard introduces a concept of "flow", all inputs and outputs are abstracted into a unified "thing" to operate, do not need to tube specific equipment and location, like a river, a lot of tributaries, but the tributary of the water once flowed into the main river, that from the downstream view of the water is main river water, not related to tributaries. With the concept of "flow", computer programming allows for uniform operation of inputs and outputs. Different types of input sources can be manually or automatically change the input to run the program. Any output device that can be used can also be programmed to output the required content. That's the redirect.

Redirected applications can be implemented in the operating system using the command line. The book uses Linux and DOS for example, no practice, so don't say it.

· Eof

For a file, the contents and size of the file can be arbitrary. For systems and programs, there are several ways to determine the end of a file. One is judged by the size of the file, the other is the EOF symbol at the end of the file's content, and the end of the file is found by detecting EOF. The actual value of the EOF (end of file) does not need to be considered, and the difference between the operating system and the language becomes affected by the specific value of EOF, and the EOF in C is defined as-1 in stdio.h.

C Primer Plus Unit eighth-character input/output confirmation

Related Article

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.