Fix progress show.

This commit is contained in:
2022-08-30 14:04:21 +01:00
parent 0d1e77e099
commit dd808771fa

10
main.c
View File

@@ -90,6 +90,11 @@ int main(int argc, char** argv)
in_read = read(fd_in, in_buf, block_size);
printf("\rProcessing position %d of %ld (%f%%)",
0,
last_pos,
0.0);
while(in_read > 0)
{
current_pos = lseek(fd_in, 0, SEEK_CUR);
@@ -123,6 +128,11 @@ int main(int argc, char** argv)
in_read = read(fd_in, in_buf, block_size);
}
printf("\rProcessing position %ld of %ld (%f%%)",
current_pos,
last_pos,
((float)current_pos * 100.0) / (float)last_pos);
close(fd_in);
close(fd_out);
free(in_buf);