equivalent to is_open() ?

This is a discussion on equivalent to is_open() ? within the C Programming forums, part of the General Programming Boards category; Is there any standard way to check to see if a file is open? I have looked through stdio.h, but ...

  1. #1
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    435

    equivalent to is_open() ?

    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

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    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.

  3. #3
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    435
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. string equivalent of sprintf()
    By e66n06 in forum C++ Programming
    Replies: 4
    Last Post: 08-16-2007, 04:30 PM
  2. Pointer equivalent to array notation
    By bekkilyn in forum C Programming
    Replies: 4
    Last Post: 12-06-2006, 08:22 PM
  3. Replies: 10
    Last Post: 08-18-2005, 12:17 AM
  4. Header File Question(s)
    By AQWst in forum C++ Programming
    Replies: 10
    Last Post: 12-23-2004, 11:31 PM
  5. UNIX fork() equivalent in Windows
    By argon in forum Windows Programming
    Replies: 2
    Last Post: 01-04-2002, 01:56 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21