Hey, its kinda an fgets problem but not really, a logical one I guess. You never print "where do i live?".
Code:
/* The first time this executes we read "who am i?" */
if(fgets(question,BUFSIZ,quiz_question)==0){
/* Ok then we print it */
printf("%s\n",question);
/* Then we read "where do i live?" */
while(fgets(question,BUFSIZ,quiz_question)!=NULL)
/* Then we read "where did the previous question went???" */
if(fgets(question,BUFSIZ,quiz_question)==0){
/* Then we print it */
printf("%s\n",question);
/* Notice we Never printed "where do i live?" */
To fix this, you can simplify it like
Code:
fgets(question,BUFSIZ,quiz_question);
if(strcmp(question,question_header)==0){
while(fgets(question,BUFSIZ,quiz_question)!=NULL)
printf("%s", question);
}
I hope that makes sense, goodluck.
EDIT - sorry didn't see dave's post, but yae what he said heh. Posted 1 minute before me