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 (-_-;).
This commit is contained in:
Nicolás A. Ortega 2016-12-27 22:34:34 +01:00
parent f2eb3e869e
commit 63aa8e14cb
No known key found for this signature in database
GPG Key ID: 614272579C2070D1

View File

@ -41,13 +41,15 @@ int exportPrimes(char *file, List *list, int base) {
// Assert safeguards // Assert safeguards
assert(file != NULL); assert(file != NULL);
assert(list != NULL); assert(list != NULL);
assert(list->list != NULL);
FILE *eFile = fopen(file, "w"); FILE *eFile = fopen(file, "w");
if(eFile == NULL) return 1; if(eFile == NULL) return 1;
printf("Exporting primes to `%s'...\n", file); printf("Exporting primes to `%s'...\n", file);
puts("0%"); puts("0%");
for(size_t i = 0; i < list->end; ++i) { 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%"); if(i == list->end / 4) puts("25%");
else if(i == list->end / 2) puts("50%"); else if(i == list->end / 2) puts("50%");
else if(i == list->end * 3 / 4) puts("75%"); else if(i == list->end * 3 / 4) puts("75%");