Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "MAJFacture.h"
- #include <stdio.h>
- #include <string>
- #include <stdlib.h>
- Article lireArt(FILE *fe)
- {
- Article art;
- int lg ;
- fgets(art.Reference, 5, fe) ;
- lg=strlen(art.Reference) ;
- art.Reference[lg-1]='\0' ;
- fgets(art.Designation, 30, fe) ;
- lg=strlen(art.Designation) ;
- art.Designation[lg-1]= '\0' ;
- fscanf(fe, "%d", &art.Prix) ;
- fscanf(fe, "%d", &art.Quantite) ;
- return art ;
- }
- Article* chargeFarticle (FILE *fe, int* nbart)
- {
- Article * art ;
- int i = 0 ;
- art = (Article)malloc(sizeof(Article));
- if(art == NULL){
- printf("Problème d'allocation sur art\n") ;
- return ;
- }
- for(i = 0; i < *nbart; i++ ){
- *art[i] = lireArt(fe) ;
- }
- return art ;
- }
- void AffichArt(Article *tart, int nbart)
- {
- int i ;
- for(i = 0; i < nbart ; i++ ){
- printf("%c %c %d %d\n",art.Reference, art.Designation, art.Prix, art.Quantite);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement