master
Louis GERMAIN 1 year ago
parent 65181e1871
commit 8267fef500

@ -1,5 +1,4 @@
#include "structures.h"
#include <stdio.h>
void trace(char str[]);

@ -1,8 +1,3 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "charge.h"
#define TMAXTRAV 8

@ -1,3 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct
{
char *nomE;

@ -8,8 +8,8 @@ Offre **initTabTravaux(void)
trace("initTabTravaux");
Offre **tabTravaux;
tabTravaux = (Offre **)malloc(TMAXTRAV* sizeof(Offre *));
if (!tabTravaux)
tabTravaux = (Offre **)malloc(TMAXTRAV * sizeof(Offre *));
if (tabTravaux == NULL)
{
printf("\033[0;31mErreur: \033[0mmalloc tableau tabTravaux\n");
exit(1);
@ -41,7 +41,7 @@ char *readFromFile(FILE *file)
int add = 5;
str = (char *)malloc(size * sizeof(char));
if (!str)
if (str == NULL)
exit(1);
while (str[len] != '\n')
@ -51,7 +51,7 @@ char *readFromFile(FILE *file)
{
size += add;
buf = realloc(str, size);
if (!buf)
if (buf == NULL)
{
free(str);
exit(1);
@ -92,8 +92,11 @@ Offre **loadOffre(void)
FILE *devisFile;
devisFile = fopen("files/devis.txt", "r");
if (!devisFile) //ERREUR
if (devisFile == NULL) //ERREUR
{
printf("\033[0;31mErreur: \033[0mouverture devis.txt");
exit(1);
}
while (!feof(devisFile))
loadDevis(devisFile, tabTravaux);

@ -37,7 +37,7 @@ void minTravaux(Offre *tabTravaux[])
md = NULL;
s = NULL;
minDev = tabTravaux[i]->ldevis;
if (!md && minDev->suiv)
if (md == NULL && minDev->suiv)
md = minDev->suiv;
while (md)
{
@ -48,9 +48,9 @@ void minTravaux(Offre *tabTravaux[])
minDev = md;
md = md->suiv;
}
else if ((md->dev).prix == (minDev->dev).prix && ((md->dev).capital == (minDev->dev).capital))
else if ((md->dev).prix == (minDev->dev).prix && ((md->dev).capital == (minDev->dev).capital)) // PAS UNE ERREUR
{
printf("deux offres minimales !!!\n");
printf("deux offres minimales !\n");
exit (1);
}
else

Loading…
Cancel
Save