mkhaw@teknowledge-vaxc.ARPA (Mike Khaw) (04/01/88)
Calling fflush after fclose appears not to hurt under Unix, but VMS returns EOF. Is there a way to test if a FILE *fptr has been closed so that I don't inadvertently call fflush after fclose? Ideally the solution is a function in both the usual Unix C libraries and in the VMS C runtime library. (If you're reading this in comp.os.vms, please reply by email, as I don't usually pay any attention to VMS :)) Thanks, Mike Khaw -- internet: mkhaw@teknowledge-vaxc.arpa usenet: {uunet|sun|ucbvax|decwrl|uw-beaver}!mkhaw%teknowledge-vaxc.arpa USnail: Teknowledge Inc, 1850 Embarcadero Rd, POB 10119, Palo Alto, CA 94303
ron@topaz.rutgers.edu (Ron Natalie) (04/02/88)
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