fflush() is supposed to return EOF if the file is closed, even on UNIX. You get what you ask for. You're lucky you don't get screwed on UNIX, many stdio implementations dump core when you pass them a bogus file pointer. Why not recode your program such that it works properly and not attempt to use file pointers that have been closed? -Ron