Before you implement the progress bar, learn the makefile first.
There are countless source files in a project, which are placed in several directories by type, function and module, and makefile defines a series of rules to specify which files need to be compiled first, which files need to be compiled, which files need to be recompiled, and even more complex functional operations. Make is a command tool that is a command tool that interprets instructions in makefile.
Beginners can only implement the following lines of simple code.
Use of MAKE commands
Take a look at the progress bar.
Principle: Each output of the character is more than the last character of the output of one, through the sleep function to control how often output once, and do not use a newline, only use the carriage return.
Note: 1. The difference between a carriage return and a newline
Before the computer appeared, there was a gadget called a telex typewriter (teletype Model 33) that could play 10 characters per second. But it has a problem, that is, when the line is finished, it will take 0.2 seconds to hit two characters. If there are new characters coming in this 0.2 seconds, then this character will be lost. So, the developers think of a way to solve this problem, is to add two after each line to end the character. One is called "carriage return", which tells the typewriter to position the printhead at the left border, and the other is called "line break", telling the typewriter to move the paper down one line. This is the origin of "line break" and "carriage return".
So
\ r Enter: Causes the cursor to return to the beginning of this line
\ n Wrap: Make the cursor to the next line
The output at 2.linux is cached, and if the display is refreshed in a timely manner, the Fflush function needs to be called.
:
Simple implementation of the progress bar under Linux