Hi
I am using a simple program. First i m asking user to enter three value. I am reading those values in structure and writing the values in file.Then i am asking user whether would like to enter another record. I am reading the option with getchar() funtion. While i am running the program it is not stopping for user input Y or N. After reading first three input, the program is closing.
Code:
while(another=='Y')
{
another=getchar();
printf("\n Enter schedule id,schedule name and schedule description\n");
scanf("%d %s %s",&schinf.sch_id,schinf.sch_name,schinf.sch_dsc);
printf("%d %s %s",schinf.sch_id,schinf.sch_name,schinf.sch_dsc);
fwrite(&schinf,sizeof(schinf),1,fp);
fflush(stdin);
putchar(another);
printf("Would you like to enter another record?\n");
another=getchar();
}
Can anyone tell what could be the reason?
Thanks
Sas