This repository has been archived on 2026-04-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
c-net/util.c
2023-09-21 11:22:31 +02:00

20 lines
418 B
C

//
// Created by jakob on 21.09.2023.
//
#include "util.h"
#include <stdio.h>
void updateBar(int percent_done){
const int BAR_LENGTH = 30;
int numChar = percent_done * BAR_LENGTH / 100;
printf("\r[");
for(int i = 0; i < numChar; i++){
printf("#");
}
for(int i = 0; i < BAR_LENGTH - numChar; i++){
printf(".");
}
printf("] (%d%%)", percent_done);
fflush(stdout);
}