In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces an example of using C language to simulate the standard input standard input file stream, which has a certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.
Stdin is a file descriptor that stands for standard input (keyboard, etc.), that is, in linux, stdin is called standard input (standard input) of terminal (Terminal).
Stdin,stdout and stderr are often seen in linux, which can be called terminal (Terminal) standard input (standard input), standard output (standard out) and standard error output (standard error).
Looking at the manual through man stdin, you can see that they are all defined in stdio.h. When linux starts to execute the program, the program opens these three file streams by default, so that it can input and output to the terminal.
Let's simulate the standard input (standard input) file stream in C language.
Standard input (standard input)
In C language, it is shown as calling scanf function to accept user input, that is, input content from terminal device. You can also use fscanf to indicate what stdin receives. The file identifier for standard input is 0.
# include intmain (void) {charstr [10]; scanf ("% s", str); fscanf (stdin, "% s", str); return0 } Thank you for reading this article carefully. I hope it will be helpful for everyone to share the sample content of simulating the standard input standard input file stream in C language. At the same time, I also hope that you will support it, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.