print ...

#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>

#define clear() printf("\033[H\033[2J")

int main(void) {
	uint32_t running = 0;

	char *symbol[] = {"⠾", "⠷", "⠯", "⠟", "⠻", "⠽", "⠿"};

	do {
        clear();
        
		fprintf(
			stdout,
			"%s\t%s\n",
			symbol[running % (sizeof(symbol) / sizeof(*symbol) - 1)],
			"Download file ....");

		clear();

		if (running > UINT32_MAX)
			break;

		sleep(1);
	} while (++running);
}

posted @ 2022-08-08 13:28  sfdevs  阅读(10)  评论(0编辑  收藏  举报