aoc-2020/turbo_main.c

30 lines
576 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <stdio.h>
#include <stdlib.h>
#define FILETEST "test"
#define FILEINPUT "input"
void prem_partie(FILE *ptr);
void deux_partie(FILE *ptr);
int main(int argc, char *argv[])
{
char *filename = argc > 1 ? FILETEST : FILEINPUT;
FILE *ptr = fopen(filename, "r");
if (ptr == NULL)
{
printf("Le fichier %s nexiste pas.\n", filename);
return 1;
}
printf("Traitement de la première partie…\n");
prem_partie(ptr);
fseek(ptr, 0, SEEK_SET);
printf("\nTraitement de la deuxième partie…\n");
deux_partie(ptr);
fclose(ptr);
return 0;
}