check fopen

This commit is contained in:
Francois Perrad 2017-12-10 10:12:09 +01:00
parent 0dbea3b69f
commit 44d14a398d
3 changed files with 184 additions and 178 deletions

View File

@ -16,6 +16,7 @@ int main(void)
mp_init_multi(&q, &p, NULL);
out = fopen("2kprime.1", "w");
if (out != NULL) {
for (x = 0; x < (int)(sizeof(sizes) / sizeof(sizes[0])); x++) {
top:
mp_2expt(&q, sizes[x]);
@ -73,6 +74,7 @@ top:
fflush(out);
}
fclose(out);
}
return 0;
}

View File

@ -14,6 +14,7 @@ int main(void)
mp_init(&b);
out = fopen("drprimes.txt", "w");
if (out != NULL) {
for (x = 0; x < (int)(sizeof(sizes)/sizeof(sizes[0])); x++) {
top:
printf("Seeking a %d-bit safe prime\n", sizes[x] * DIGIT_BIT);
@ -56,6 +57,7 @@ top:
}
}
fclose(out);
}
mp_clear(&a);
mp_clear(&b);

View File

@ -36,6 +36,7 @@ static void gen_prime(void)
FILE *out;
out = fopen("pprime.dat", "wb");
if (out != NULL) {
/* write first set of primes */
/* *INDENT-OFF* */
@ -151,6 +152,7 @@ static void gen_prime(void)
fclose(out);
}
}
static void load_tab(void)
{