Is there any standard way to check to see if a file is open? I have looked through stdio.h, but it doesn't look like it has anything. What happens to a FILE after it is closed with fclose() ?
Is there any standard way to check to see if a file is open? I have looked through stdio.h, but it doesn't look like it has anything. What happens to a FILE after it is closed with fclose() ?
I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo
Any buffers are flushed and the file is closed. The pointer still dangles, though, if that's what you're asking. If you're opening and closing file handles, you can set the pointer to NULL when you close a file, and check for that before reopening.
Thanks tabstop. That answered my question perfectly.
I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo