When i type first time 1 the printf appeared, but the second time i typed 1 there where no printf...can anyone help me? Code: #include #include struct Info{ char name[81]; int age; char email[81]; int c; }; int main(void){ FILE* infile; struct Info info; infile = fopen("my_file.txt","r+"); // pos: r, w, a, r+, w+, a+ if(infile ==NULL){ printf("File does not exist.\n"); exit(1); }else{ printf("Please type 1 to see the statistics.\n"); printf("Please type 2 to add a new contact.\n"); printf("Plesase type 0 to exit.\n"); scanf("%d", &info.c); while(1){ if(info.c == 1){ while(fscanf(infile,"%s %d %s", info.name, &info.age, info.email) != EOF){ printf("\tName: %s\n", info.name); printf("\tAge: %d\n", info.age); printf("\tE-mail: %s\n\n", info.email); } }else if(info.c == 2){ printf("New name:\n"); scanf("%s", info.name); printf("New age:\n"); scanf("%d", &info.age); printf("New e-mail:\n"); scanf("%s", info.email); fprintf(infile,"%s %d %s", info.name, info.age, info.email); fclose(infile); infile = fopen("my_file.txt","r+"); }else{ exit(0); } printf("Please type 1 to see the statistics.\n"); printf("Please type 2 to add a new contact.\n"); printf("Plesase type 0 to exit.\n"); scanf("%d", &info.c); } } fclose(infile); return 0; }