X-Git-Url: https://git.llucax.com/z.facultad/75.06/jacu.git/blobdiff_plain/37100ced5f987acf14c097fe4c31e197d30f4eb5..2ea01495176fc0d471d75a01354d3f630ee5328a:/src/blocksorting/main.c diff --git a/src/blocksorting/main.c b/src/blocksorting/main.c index 704c570..f73ed12 100644 --- a/src/blocksorting/main.c +++ b/src/blocksorting/main.c @@ -15,7 +15,7 @@ int main(int argc, char *argv[]) fp = fopen(argv[1], "r"); len = atoi(argv[2]); } else if (argc == 2) { - fp = stdin; /*fopen(argv[1], "r");*/ + fp = stdin; len = atoi(argv[1]); } else { printf("no, no\n"); @@ -23,7 +23,7 @@ int main(int argc, char *argv[]) } data = malloc(sizeof(char)*len); - salida = malloc(sizeof(char)*(len+1)); + salida = malloc(sizeof(char)*(len+1+sizeof(unsigned long int)*2)); orig = malloc(sizeof(char)*(len+1)); salida[len] = '\0'; @@ -48,13 +48,12 @@ int main(int argc, char *argv[]) bs_restore(orig, salida, k, i); printf("Orig : %s\n", orig); } else - printf("(%s)\n", salida); + fwrite(salida, 1, i, stdout); } fclose(fp); bs_destroy(bs); - printf("Total bytes : %ld\n", total); - free(data); + /*printf("Total bytes : %ld\n", total);*/ free(salida); free(orig); return 0;