parent
4c2f4eab24
commit
1638f9b0f1
@ -0,0 +1,3 @@ |
||||
#pragma once |
||||
|
||||
void draw_progress(FILE *fp, unsigned long pos, unsigned max); |
@ -0,0 +1,22 @@ |
||||
#include <stdio.h> |
||||
|
||||
#define TERM_WIDTH 80 |
||||
|
||||
void draw_progress(FILE *fp, unsigned long pos, unsigned long max) |
||||
{ |
||||
unsigned long head = (TERM_WIDTH - 2) * pos / max; |
||||
unsigned long i; |
||||
|
||||
fputc('[', fp); |
||||
|
||||
for (i = 0; i <= head; ++i) |
||||
fputc('#', fp); |
||||
|
||||
for (; i < (TERM_WIDTH - 2); ++i) |
||||
fputc(' ', fp); |
||||
|
||||
fputc(']', fp); |
||||
|
||||
for (i = 0; i < TERM_WIDTH; ++i) |
||||
fputc('\b', fp); |
||||
} |
Loading…
Reference in new issue