In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "C language how to solve black window flicker". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Experience the Linux environment under Windows, in which the test code simply prints a sentence, such as:
After compilation, you get test.exe, and run it to get the following result:
Run from the command line to output the results, but under the folder, double-click to run test1.exe and notice that a black window flashes by:
How to pause the black window? There are two ways:
[method 1] add a line of code at the end of the program:
System ("pause")
At the same time, add the header file stdlib.h, namely
System is a function in the C function library stdlib.h. The function prototype is:
Int system (const char * command)
Send the command command to the system, where the pause command means to pause the program and display a Chinese message: "Please press any key to continue", or the English message: "Press any key to continue."
Compile and run the result as follows:
Some IDE (integrated development environment) will automatically output "Please press any key to continue." If you want to pause the program, you have to manually add system ("pause"); this code.
[method 2] add a line of code at the end of the program:
Getchar ()
That is:
Getchar () is used to read a key press (read characters). When the program calls getchar (), the program waits for the user to press the key. The characters entered by the user are stored in the keyboard buffer until the user presses enter (the carriage return character is also placed in the buffer). About getchar (), can you see the difference between getchar (), getche (), and getch ()?
Compile, run the result:
This is the end of the content of "how to solve the problem of black window flicker in C language". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.