Commit 87d9b5fb authored by Louis Malevez's avatar Louis Malevez

Fonction qui lit input et écrit ouput

parent cd74c93b
Pipeline #4636 passed with stage
in 0 seconds
//
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment