How is the rotation slash made in emerge ? ( / ) He writes: Calculating dependencies /
And the slash rotates. How is this done? I want to repeat.
How is the rotation slash made in emerge ? ( / ) He writes: Calculating dependencies /
And the slash rotates. How is this done? I want to repeat.
I'm pretty sure that they (emerge) do it this way (and not \ r and output the entire line, which would cause some ripples on the screen)
You can try and play around with a delay (usleep)
#include <stdio.h> int main (int ac, char *av[]) { int i, j; char *s = "/-\\|"; fputs("test ", stdout); fflush(stdout); for (i = 0; i < 100; i++) for (j = 0; j < 4; j++) { printf("\b%c", s[j]); fflush(stdout); // символ \b -- BACKSPACE -- шаг назад usleep(100000); } } If only one character needs to be retyped - just typing \ b - moves the cursor back 1 position.
Probably every time the same line is reprinted, only one character changes: -, \, |, / -
when outputting to the console, you can control the carriage using the '\ r' character
printf("hello"); printf("\rbye"); Source: https://ru.stackoverflow.com/questions/418377/
All Articles