aoc-2020/turbo_main.c

37 lines
629 B
C
Raw 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>
void prem_partie(FILE *ptr);
void deux_partie(FILE *ptr);
int main(int argc, char *argv[])
{
char *filename;
if (argc > 1)
{
char test[6] = "test";
filename = test;
}
else
{
char input[6] = "input";
filename = input;
}
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;
}