Commit 273b1678 by Rudolf

Compare original vs encoded file sizes

parent eb9ada04
Showing with 10 additions and 1 deletions
......@@ -140,9 +140,16 @@ int main(int argc, char *argv[])
if (decompress)
ret = decode_file(input, output);
else
else {
ret = encode_file(input, output);
long insize = get_file_size(input);
long outsize = get_file_size(output);
printf("Original file size: %ld bytes\n", insize);
printf("Huffman file size: %ld bytes\n", outsize);
}
fclose(input);
fclose(output);
return ret;
......
......@@ -35,6 +35,8 @@ struct tree *create_tree(FILE *file)
if (c == EOF || c > MY_BUF-1)
break;
/* While theoretically these files *can* be supported, Huffman is meant
* for text encoding/decoding, so we don't give a sh. */
if (c > MY_BUF-1 || c == EOF_CHAR) {
fprintf(stderr, "File not supported\n");
return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment