mini@giants.wpd.sgi.com (Mark Minnihan) (02/06/91)
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