ostream::write() error result

P

Piotr

How to handle "lack of disk space" during the ostream::write() function. As
far as I know

the is ios::rdstate() function which returns 4-bit state flag:

badbit (critical error in stream buffer)
eofbit (End-Of-File reached while extracting)
failbit (failure extracting from stream)
goodbit (no error condition, represents the absence of the above bits)


but I would like to know if there was not enough free disk space to perform
the

ostream::write() operation.
How can I get that information ?
thank you
 
T

Thomas Matthews

Piotr said:
How to handle "lack of disk space" during the ostream::write() function. As
far as I know

the is ios::rdstate() function which returns 4-bit state flag:

badbit (critical error in stream buffer)
eofbit (End-Of-File reached while extracting)
failbit (failure extracting from stream)
goodbit (no error condition, represents the absence of the above bits)


but I would like to know if there was not enough free disk space to perform
the

ostream::write() operation.
How can I get that information ?
thank you

Disks are not required by the C++ specification, so there is
no method for checking free space _using_standard_C++_.

The proper procedure is to check for an ostream error,
then use some platform specific functions for determining
the cause of the problem.

One could also use some platform specific functions for
determining the free space before writing, provide the
platform has this support.

Read the FAQ and Welcome.txt links below.
--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,832
Latest member
UtaHetrick

Latest Threads

Top