home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16656 < prev    next >
Encoding:
Text File  |  1992-11-20  |  865 b   |  32 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!taumet!steve
  3. From: steve@taumet.com (Steve Clamage)
  4. Subject: Re: g++ ofstream
  5. Message-ID: <1992Nov20.185012.26503@taumet.com>
  6. Organization: TauMetric Corporation
  7. References: <1992Nov19.173058.14847@cc.gatech.edu>
  8. Date: Fri, 20 Nov 1992 18:50:12 GMT
  9. Lines: 21
  10.  
  11. brianm@cc.gatech.edu (Brian N. Miller) writes:
  12.  
  13. >What flags should i check or what method shall i call
  14. >to determine if a once opened g++ ofstream has since been closed?
  15.  
  16. I don't know how standard the g++ implementation of iostreams is.
  17. In the usual implementation, you want the is_open() function in the
  18. filebuf.  You can call it like this:
  19.  
  20.     ofstream mystr( ... );
  21.     ...
  22.     if( mystr.rdbuf()->is_open() ) {
  23.         ... a file is open
  24.     }
  25.     else {
  26.         ... no file is open
  27.     }
  28. -- 
  29.  
  30. Steve Clamage, TauMetric Corp, steve@taumet.com
  31. Vice Chair, ANSI C++ Committee, X3J16
  32.