#include <stdio.h>
#include <unistd.h>
+long get_file_size(const char* filename);
+
int main(int argc, char* argv[])
{
int cflag = 0;
/* 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;
}
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;
+}
+