From 63aa8e14cb11f72ef69f95fdce43c8180090b54d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20A=2E=20Ortega?= Date: Tue, 27 Dec 2016 22:34:34 +0100 Subject: [PATCH] Fixed the damn exporting for once. Now I'm checking to see if it was actually worth a damn to have raw files in the first place (-_-;). --- src/files.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/files.c b/src/files.c index 3aed3aa..acb9d9c 100644 --- a/src/files.c +++ b/src/files.c @@ -41,13 +41,15 @@ int exportPrimes(char *file, List *list, int base) { // Assert safeguards assert(file != NULL); assert(list != NULL); + assert(list->list != NULL); FILE *eFile = fopen(file, "w"); if(eFile == NULL) return 1; printf("Exporting primes to `%s'...\n", file); puts("0%"); for(size_t i = 0; i < list->end; ++i) { - if(mpz_out_str(eFile, list->list[i], base) == 0) return 3; + if(mpz_out_str(eFile, base, list->list[i]) == 0) return 3; + fprintf(eFile, "\n"); if(i == list->end / 4) puts("25%"); else if(i == list->end / 2) puts("50%"); else if(i == list->end * 3 / 4) puts("75%");