06-06-2016 11:34 AM
hello evrybody
i want to know how can i use this function in button
//First void saisir(Atelier *A,int Na) { int i ,j,taux=0 ; char aide[100] ; char intro[100] ; char intro2[100] ; for(i=0;i<Na;i++) { (A+i)->TInd=0 ; } for(i=0;i<Na;i++) { printf("-->Donner le nom d'Atlier n=%d \n",i+1); scanf("%s",aide); (A+i)->NAF=malloc(strlen(aide)+1); strcpy((A+i)->NAF,aide) ; printf("-->Donner du Responsable d'Atlier n=%d \n",i+1); scanf("%s",intro) ; (A+i)->NRA=malloc(strlen(intro)+1); strcpy((A+i)->NRA,intro) ; printf("-->Donner le Nombre d'Employer pour l'Ateier n=%d \n",i+1); scanf("%d",&(A+i)->NE); if(!((A+i)->EMP=malloc(((A+i)->NE)*sizeof(Employer)))) exit(-1); for(j=0;j<(A+i)->NE;j++) { printf("-->Donner le nom d'Employer n=%d \n",j+1); gets(intro2) ; gets(intro2) ; (A+i)->EMP[j].nom=malloc(strlen(intro2)+1); strcpy((A+i)->EMP[j].nom,intro2) ; printf("-->Donner le NPF d'Employer n=%d \n",j+1); scanf("%d",&(A+i)->EMP[j].NPF) ; printf("-->Donner l'indiceP d'Employer n=%d \n",j+1); scanf("%c",&(A+i)->EMP[j].IndiceP) ; scanf("%c",&(A+i)->EMP[j].IndiceP) ; if ((A+i)->EMP[j].IndiceP =='A') taux=20 ; else if ((A+i)->EMP[j].IndiceP =='B') taux=10 ; else taux=5 ; (A+i)->EMP[j].IndP=taux*((A+i)->EMP[j].NPF) ; (A+i)->TInd += ((A+i)->EMP[j].IndP) ; } } } //Second float Tind(Atelier *A,int NA) { float Total=0 ; int i ; for(i=0;i<NA;i++) { Total += ((A+i)->TInd) ; } return Total ; } //third void affiche(Atelier *A,int Na) { int i,j ; float TotalID ; TotalID=Tind(A,Na) ; printf("\n"); printf("--------------------------------------------------------------------------------\n"); printf("FICHE DE GESTION DES INDEMNITES DES EMPLOYES MOTOPROD (par journée)\n"); printf("--------------------------------------------------------------------------------\n"); for(i=0;i<Na;i++) { printf("Nom Atelier de Fabrication %d=%s | Nom Responsable Atelier %d=%s \n",i+1,(A+i)->NAF,i+1,(A+i)->NRA); printf(" Nom\tNPF\tIndiceP\tIndP\n"); for(j=0;j<(A+i)->NE;j++) { printf(" %s\t%d\t%c\t%.2f\n",(A+i)->EMP[j].nom,(A+i)->EMP[j].NPF,(A+i)->EMP[j].IndiceP,(A+i)->EMP[j].IndP); } printf("--------------------------------------------------------------------------------\n"); printf(" Total Indemnité=%.2f\n",(A+i)->TInd) ; printf("--------------------------------------------------------------------------------\n"); } printf("Totaux des indemnites des employes du Groupe MotoProd pendant la journée=%.2f\n",TotalID) ; printf("--------------------------------------------------------------------------------"); } //fourth void ecrirefichier(Atelier *A,int Na) { int i,j ; float TotalID=0; FILE *EMPLOYESMOTOPROD=NULL ; TotalID=Tind(A,Na) ; EMPLOYESMOTOPROD=fopen("employesmotoprod.txt","w") ; if(EMPLOYESMOTOPROD !=NULL) { printf("le fichier a etait bien creer"); fprintf(EMPLOYESMOTOPROD,"--------------------------------------------------------------------------------\n"); fprintf(EMPLOYESMOTOPROD,"FICHE DE GESTION DES INDEMNITES DES EMPLOYES MOTOPROD (par journée)\n\n"); fprintf(EMPLOYESMOTOPROD,"--------------------------------------------------------------------------------\n"); for(i=0;i<Na;i++) { fprintf(EMPLOYESMOTOPROD,"Nom Atelier de Fabrication %d=%s | Nom Responsable Atelier %d=%s \n",i+1,(A+i)->NAF,i+1,(A+i)->NRA) ; fprintf(EMPLOYESMOTOPROD," Nom\tNPF\tIndiceP\tIndP\n") ; for(j=0;j<(A+i)->NE;j++) { fprintf(EMPLOYESMOTOPROD," %s\t%d\t%c\t%.2f\n",(A+i)->EMP[j].nom,(A+i)->EMP[j].NPF,(A+i)->EMP[j].IndiceP,(A+i)->EMP[j].IndP) ; } fprintf(EMPLOYESMOTOPROD,"--------------------------------------------------------------------------------\n"); fprintf(EMPLOYESMOTOPROD," Total Indemnité=%.2f\n",(A+i)->TInd) ; fprintf(EMPLOYESMOTOPROD,"--------------------------------------------------------------------------------\n"); } fprintf(EMPLOYESMOTOPROD,"Totaux des indemnites des employes du Groupe MotoProd pendant la journée=%.2f\n",TotalID) ; fprintf(EMPLOYESMOTOPROD,"--------------------------------------------------------------------------------\n"); fclose(EMPLOYESMOTOPROD) ; } else printf("le fichier n'est pas creer"); }
please help me i must complete this , t read tutoriel but i don't understand
thanks a lot
06-07-2016 08:44 AM
Hi hamham,
Could you explain what you mean exactly by using the function in a button? Also, which tutorial are you using to work off of?
06-07-2016 08:50 AM - edited 06-07-2016 08:50 AM
Mathew, this thread is the prosecution of this other one. The tutorial I was pointing hamham to in my posts there is the Getting Started with CVI document.
At present is not clear to me whether hamham has terminated creating the sample project which will give him the correct framework where to insert the call to his function.
Hamham, in the future please maintain the discussion about a question in a single thread, otherwise it become difficult to understan what has already been discussed about it.