This commit is contained in:
Adrien VAN DAMME 2017-04-03 13:35:51 +02:00
parent e90e7b5511
commit e1654ee12e
1 changed files with 12 additions and 5 deletions

View File

@ -74,7 +74,7 @@ int itoaY(int i, char*);
int itoaDM(int i, char*); int itoaDM(int i, char*);
Bool clean_keyboard(); Bool clean_keyboard();
int ageClient(Client *, Date *); int ageClient(Client *, Date *);
Client * rechercheClient(char *, char*, FILE *, Date *); unsigned int rechercheClient(char *, char*, FILE *, Client *, Date *);
Bool gestionClient(Client *, Date *); Bool gestionClient(Client *, Date *);
int compNP(char *, char *,char *, char *); int compNP(char *, char *,char *, char *);
void localiserFichiersClients(char *, FILE **); void localiserFichiersClients(char *, FILE **);
@ -84,6 +84,7 @@ Bool fichierExistant(char *);
void sauvergarderFacture(FILE *, Date *, Client *); void sauvergarderFacture(FILE *, Date *, Client *);
void sauvegarderClientTXT(Client *, FILE *, Bool,...); //EcrireDonneesClient void sauvegarderClientTXT(Client *, FILE *, Bool,...); //EcrireDonneesClient
void clientBinToTXT(FILE *, FILE*); void clientBinToTXT(FILE *, FILE*);
void modificationClient(Client *, FILE *);
int main() int main()
{ {
@ -109,6 +110,7 @@ int main()
} }
Client * client; Client * client;
unsigned int ofsetFileCurClient;
char nomClient[__STRLEN__],prenomClient[__STRLEN__]; char nomClient[__STRLEN__],prenomClient[__STRLEN__];
char fichierClientDat[__STRLEN_FILE__]; char fichierClientDat[__STRLEN_FILE__];
int choixMenu; int choixMenu;
@ -134,7 +136,7 @@ int main()
clean_keyboard();scanf("%s", nomClient); clean_keyboard();scanf("%s", nomClient);
printf("\npRENOM du client (sensible a la casse) : "); printf("\npRENOM du client (sensible a la casse) : ");
clean_keyboard();scanf("%s", prenomClient); clean_keyboard();scanf("%s", prenomClient);
client = rechercheClient(nomClient,prenomClient, clientF[__TAB_CLIENTDAT_FILE__], &date); ofsetFileCurClient = rechercheClient(nomClient,prenomClient, clientF[__TAB_CLIENTDAT_FILE__], client, &date);
if(client != NULL) if(client != NULL)
{ {
w = gestionClient(client, &date); w = gestionClient(client, &date);
@ -147,6 +149,7 @@ int main()
break; break;
} }
} }
free(client);
fclose(clientF[__TAB_CLIENTDAT_FILE__]); fclose(clientF[__TAB_CLIENTDAT_FILE__]);
return 0; return 0;
} }
@ -570,9 +573,8 @@ void gestionFacture(Client * client, Date * date)
free(client->panier.article); free(client->panier.article);
} }
Client * rechercheClient(char nom[__STRLEN__], char prenom[__STRLEN__], FILE * clientF, Date * date) unsigned int rechercheClient(char nom[__STRLEN__], char prenom[__STRLEN__], FILE * clientF, Client * client, Date * date)
{ {
Client * client = NULL;
client = malloc(sizeof(Client)); client = malloc(sizeof(Client));
fseek(clientF, 0, SEEK_SET); fseek(clientF, 0, SEEK_SET);
clearerr(clientF); //Clear EOF clearerr(clientF); //Clear EOF
@ -707,7 +709,7 @@ int compNP(char *nom1, char *prenom1,char *nom2, char *prenom2)
return renvois; return renvois;
} }
void clientBinToTXT(FILE * bin, FILE* txt) void clientBinToTXT(FILE * bin, FILE* txt) //======================================================================
{ {
Client client; Client client;
fseek(bin, 0, SEEK_SET);fseek(txt, 0, SEEK_SET); fseek(bin, 0, SEEK_SET);fseek(txt, 0, SEEK_SET);
@ -721,3 +723,8 @@ void clientBinToTXT(FILE * bin, FILE* txt)
} }
// fread() // fread()
} }
void modificationClient(Client * client, FILE * clientF)
{
}