diff --git a/prime.c b/prime.c new file mode 100644 index 0000000000000000000000000000000000000000..f13d894160ab51db887f3d031df204c34b80d8b9 --- /dev/null +++ b/prime.c @@ -0,0 +1,37 @@ +// +// Created by Louis Malevez on 18-04-20. +// +#include <stdio.h> +#include <stdlib.h> +#include "Fonction_liste.h" +#include"Factor.h" + + +int main(int argc, char *argv[]) { + printf("argv[1]: %s\n", argv[1]); // argv[1] = input file path + printf("argv[2]: %s\n", argv[2]); // argv[2] = output file path + FILE *f_in = fopen(argv[1], "r"); + FILE *f_out = fopen(argv[2], "w"); + if (f_in == NULL) exit(1); + if (f_out == NULL) exit(1); + + + int chiffre =0; + + while (fscanf(f_in, "%d", &chiffre) != EOF) {// parcours les entiers + struct dblist Maliste; + Init(&Maliste); + primeFactors(&Maliste,chiffre); + wfile(Maliste,f_out); + fprintf(f_out,"\n"); + Clear(&Maliste); + + + } + + fclose(f_in); + fclose(f_out); + return 0; +} + +