Ask your own question, for FREE!
Computer Science 12 Online
OpenStudy (anonymous):

I have a function to read the values of one line of the file and put them into a structure. How can I have another function that loops this one and detects the EOF?

OpenStudy (anonymous):

In C

OpenStudy (e.mccormick):

http://www.cprogramming.com/tutorial/c/lesson14.html

OpenStudy (anonymous):

It's not working like that unfortunately. Maybe I haven't been clear in my question. I have a function defined as void reading(CDR call, FILE * DataBase) and in this function I only read one line of the file and assign it to the proper "space" of the structure (and this is working properly) Bu then in another function (void write_made(int *number, FILE *DataBase)) I want to something like while the file is not in EOF keep running the function reading. I don't want to merge booth functions because the function reading will be helpful in the rest of the program and I want to be able to use it again without limiting it. The checking of the EOF made in the second function does not seem to work, I've tried doing it with while(( c=fgetc(DataBase)) != EOF) and it's not working, I also tried to but a "Check" in the end of the reading function [ if( (c=fgetc(DataBase)) != EOF) check = 1; else check = 0; return check; ] I know that EOF equals -1 and i have c as an integer, the reason I have made check equal to 0 or 1 is to do while(check). But nothing seems to work... (CDR is a structure)

OpenStudy (rsmith6559):

do { reading(CDR call, FILE * DataBase) } while( !feof( DataBase ) )

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!