parent
9a397648d3
commit
710723a79d
@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* @file chargement.c
|
||||||
|
* @brief Fonctions de chargement des fichiers de données
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "specification1.h"
|
||||||
|
|
||||||
|
int chargement(Offre *offre, char fichier[])
|
||||||
|
{
|
||||||
|
FILE *flot;
|
||||||
|
flot = fopen(fichier, "r");
|
||||||
|
if(flot==NULL)
|
||||||
|
{
|
||||||
|
printf("[ERREUR] - Problème dans l'ouverture de %s en lecture !\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int tLog;
|
||||||
|
fscanf(flot, "%d", &tLog); // Lecture de l'en-tête
|
||||||
|
if(tLog <= 0)
|
||||||
|
{
|
||||||
|
printf("[ERREUR] - Il n'y a pas de donnée à charger dans le fichier spécifié ou vous n'avez pas un en-tête valide.\n");
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
offre = (Offre*)malloc(tLog*sizeof(Offre));
|
||||||
|
for(int i=0; i<tLog; i++)
|
||||||
|
offre[i] = lireDevis(flot);
|
||||||
|
|
||||||
|
fclose(flot);
|
||||||
|
return tLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
Offre lireDevis(FILE *flot)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* @file init.c
|
||||||
|
* @brief Fonctions d'initialisation de Pile/File/Liste
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "specification1.h"
|
||||||
|
|
Loading…
Reference in new issue