I am coding a program for a library management system as my project in c. I used a while loop along with
printf(" ! The File is Empty...\n\n");
printf("\nEnter The Name Of Book : ");
fscanf(librecord,"%d %s %s %d %d",&book.bid,book.bname,book.author,&book.status,&book.nooftitles);
printf("\nThe Unique ID of The Book: %d\nThe Name of Book is: %s\nThe Author is: %s\nThe Book Status:%s\n\n",book.bid,book.bname,book.author,stats);
printf("! There is no such Entry...\n");
You are not reading the next line from the file as you are not advancing at all.
You need to use
fgets to read a string from the file or
fgetc to read a char.
fgets stops automatically when it reads a new line character so that could be a solution to read one line at a time.
Another solution if you are using the GNU version of the C library is to use [getLine] (http://man7.org/linux/man-pages/man3/getdelim.3.html) which reads a line for you.
Whatever you use, you need to read a line and then move to the next line until the end is reached, which is not what you are doing with your current code.