FF (stdin) refreshes the standard input buffer and discards anything in the input buffer.
Fflush (STDOUT) refreshes the standard output buffer and prints the output buffer to the standard output device.
When the scanf () function receives input data, it ends the input of one data in the following cases: (not to end the scanf function, the scanf function only has data in each data field and ends with a carriage return).
① the space, "enter", "Jump" key.
② to the end of the width.
③ in the event of illegal input.
The keyboard buffer may have residual information problems.
The scanf () function should simply scan the stdin stream, the remaining information is in stdin
The solution is to add a fflush (stdin) after the scanf () function
Third, the writing of the file will not be immediately the physical disk file read and write, but first write to the cache, when the contents of the cache to a certain extent before writing
FILE *fp=fopen ("A.txt", "w");
fprintf (FP, "abcdef");
Fflush (FP);
IV, int i;
for (i=0;i<10;i++)
{
printf ("%d", I);
Fflush (stdout);
Sleep (1);
}
When there is flush, the output of a number in a second when not flush is 10 seconds after the output of 10 characters
The result is of course the same: 0123456789