From 87d9b5fb3503eb9fb1fd6cab24b3ec5e22da62cf Mon Sep 17 00:00:00 2001 From: Louis Malevez <louis.malevez@student.uclouvain.be> Date: Wed, 22 Apr 2020 15:59:48 +0200 Subject: [PATCH] =?UTF-8?q?Fonction=20qui=20lit=20input=20et=20=C3=A9crit?= =?UTF-8?q?=20ouput?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prime.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 prime.c diff --git a/prime.c b/prime.c new file mode 100644 index 0000000..f13d894 --- /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; +} + + -- GitLab