2016-10-06 16:43:57 +00:00
|
|
|
#include "../include/huf.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main(int argc, const char** argv) {
|
|
|
|
if (argc != 2) {
|
|
|
|
printf("Usage : compress <fichier>\n");
|
|
|
|
printf("Paramètre fichier manquant.\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
double* frequencies = computeFrequencies(argv[1]);
|
|
|
|
double sum = 0;
|
|
|
|
|
|
|
|
for (int i = 0; i < 256; i++) {
|
|
|
|
if (frequencies[i] != 0) {
|
|
|
|
sum += frequencies[i];
|
|
|
|
printf("%c (%d) : %f\n", i, i, frequencies[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("Total : %f\n", sum);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|