1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
void
on_button10_clicked (GtkButton *button,
gpointer user_data)
{
GtkWidget *window6;
GtkWidget *window3;
parent *P,E;
char id[50];
GtkWidget *input1;
window3=lookup_widget(button,"window3");
input1=lookup_widget(button,"entry27");
strcpy(id,gtk_entry_get_text(GTK_ENTRY(input1)));
FILE *f;
FILE *f_tmp;
printf("%s",id);
f = fopen("/home/chaima/Desktop/parent1/src/parent.txt", "r");
f_tmp = fopen("/home/chaima/Desktop/parent1/src/parent_tmp.txt", "a+");
printf("test2");
while(fscanf(f,"%s %s %s %s %s %s %s %s %s %s %s\n",P->id,P->nom,P->prenom, P->naissance,P->cin,P->adresse,P->metier,P->telephone,P->enfant,P->email, P->password)!=EOF)
{
if (strcmp(id,P->id)!=0)
{ printf("test1");
E=*P;
fprintf(f_tmp,"%s %s %s %s %s %s %s %s %s %s %s\n",E.id,E.nom, E.prenom,E.naissance,E.cin,E.adresse,E.metier,E.telephone,E.enfant,E.email,E.password);
}
};
fclose(f);
fclose(f_tmp);
remove("/home/chaima/Desktop/parent1/src/parent.txt");
rename("/home/chaima/Desktop/parent1/src/parent_tmp.txt","/home/chaima/Desktop/parent1/src/parent.txt");
gtk_widget_hide(window3);
window6=create_window6();
gtk_widget_show (window6);
}
Fin de la discussion |
Partager