468,278 Members | 1,562 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,278 developers. It's quick & easy.

ostream::write() error result

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
Jul 19 '05 #1
1 3875
Piotr wrote:
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

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Victor Irzak | last post: by
2 posts views Thread by ChrisC | last post: by
1 post views Thread by raj.sinha | last post: by
5 posts views Thread by lars | last post: by
13 posts views Thread by Aston Martin | last post: by
8 posts views Thread by kevin | last post: by
8 posts views Thread by dev_15 | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
1 post views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.