Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!ames!sgi!shinobu!odin!giants.wpd.sgi.com!mini From: mini@giants.wpd.sgi.com (Mark Minnihan) Newsgroups: comp.lang.c++ Subject: fstream problems Message-ID: <1991Feb6.021342.24547@odin.corp.sgi.com> Date: 6 Feb 91 02:13:42 GMT Sender: news@odin.corp.sgi.com (Net News) Reply-To: mini@giants.wpd.sgi.com (Mark Minnihan) Organization: sgi Lines: 27 I'm having a problem with the AT&T iostream library that I haven't been able to solve. The scenario is as follows : fstream my_stream("/tmp/foo",ios::out); my_stream.seekg(100000); my_stream << "DUMMY LINE" << endl; my_stream.close(); My problem results when the write fails( insufficient disk space,etc ). When I query the status of the stream with "my_stream.fail()", I do not get an error condition. However, if I get the file descriptor from the stream and use it to call the "write" system call, the write returns -1 as expected. I should add that when using my_stream to attempt the writes, "/tmp/foo" is created as a zero length file if there is insufficient disk space. Given that I would like to use fstream and not the file descriptor, how do I catch these types of errors. Needless to say, your help is greatly appreciated. -- thanks, Mark Minnihan