Commit 6926cfcf authored by Louis Malevez's avatar Louis Malevez

Fonction qui lit et écrit le output

parent 11055c44
//
// Created by Louis Malevez on 18-04-20.
//
#include <stdio.h>
#include <stdlib.h>
#include "primeF.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
primeFactors(chiffre,f_out);// fonction qui écrit un entier et ses diviseurs premiers ds un fichier
}
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