X-Git-Url: https://git.llucax.com/z.facultad/75.06/jacu.git/blobdiff_plain/87673889dd7bc0a18e9cefd5cae898ef0e864ba8..2ab683271e74b5cffc675da7f5b9e4b34bb4047c:/src/jacu.c diff --git a/src/jacu.c b/src/jacu.c index fc4188f..fe94998 100644 --- a/src/jacu.c +++ b/src/jacu.c @@ -8,6 +8,8 @@ #include #include +long get_file_size(const char* filename); + int main(int argc, char* argv[]) { int cflag = 0; @@ -117,6 +119,9 @@ int main(int argc, char* argv[]) /* borro el temporal */ unlink("tmp.comp"); + + /* Muestro bpb */ + printf("Comprimido a %.04f bpb.\n", get_file_size(argv[optind+1])*8.0/get_file_size(argv[optind])); return i; } @@ -158,3 +163,15 @@ int main(int argc, char* argv[]) return 0; } + +long get_file_size(const char* filename) +{ + FILE* file; + long file_size; + + if (!(file = fopen(filename, "ab"))) return -1; + file_size = ftell(file); + fclose(file); + return file_size; +} +