-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands.c
More file actions
40 lines (34 loc) · 824 Bytes
/
Copy pathcommands.c
File metadata and controls
40 lines (34 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "commands.h"
void loading(int milliseconds, char *text){
int total = 20;
char fullBar = '#';
char emptyBar = '-';
for (int i = 0; i <= total; ++i) {
int percent = 0;
printf("\r%s... [",text);
for (int j = 0; j < i; ++j) {
printf("%c", fullBar);
percent = i * 5;
}
for (int j = i; j < total; ++j) {
printf("%c", emptyBar);
}
printf("] %d%% \r", percent);
fflush(stdout);
Sleep(milliseconds);
printf("\r");
}
printf("\n\n");
}
void removeLine(int value){
for(int i = 0; i < value; i++){
printf("\033[A\033[K");
}
}
int countString(char *string){
int count = 0;
while (string[count] != '\0') {
count++;
}
return count;
}