Path: utzoo!mnetor!uunet!husc6!mailrus!tut.cis.ohio-state.edu!bloom-beacon!gatech!udel!princeton!phoenix!mjschmel From: mjschmel@phoenix.Princeton.EDU (Michael J. Schmelzer) Newsgroups: comp.lang.c Subject: fscanf and EOF in TurboC Message-ID: <2717@phoenix.Princeton.EDU> Date: 29 Apr 88 05:16:46 GMT Organization: Princeton University, NJ Lines: 25 Keywords: fscanf EOF Turbo C Hello everybody! I have a real problem. (?!?) I am using Turbo C to read through a "master file" which contains the names of all of the files to be read into my program. I'm using fscanf(fp, "%s", filename); Here's the problem: I don't know how to test for EOF in this situation. For some reason, it seems that fscanf WON'T put the file pointer at EOF when the last name is read; it will just keep returning the last name in the file. ( feof() doesn't work!) I've built a workaround: the last line in the master file MUST be END I use the conditional while (strcmp(filename, "END")) { ... } It works, but it's just not a very robust way of doing things. Any ideas how I can my program more robust for the end user? Is this a quirky implementation of fscanf? Thanks a lot!! -- "Sum Iuppiter Optimus Maximus!!"- My Latin teacher who flipped. "Worthlessness is the root of all worthlessness." -WPRB music dept. Mike Schmelzer mjschmel@phoenix!princeton.edu DISLAIMER:If you think I speak for anyone but myself, you must be a lawyer.