X-Git-Url: https://git.llucax.com/z.facultad/75.06/jacu.git/blobdiff_plain/de5da6745aa448b96eee01fbd9df0575629678b9..ade05bc64de4853d99cdc1ea2657845728614f03:/src/blocksorting/main.c diff --git a/src/blocksorting/main.c b/src/blocksorting/main.c index 2c8abb9..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", 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;