ostream::write() error result

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Piotr

    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


  • Thomas Matthews

    #2
    Re: ostream::write( ) error result

    Piotr wrote:
    [color=blue]
    > 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[/color]

    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:

    C++ Faq: http://www.parashift.com/c++-faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.l earn.c-c++ faq:

    Other sites:
    http://www.josuttis.com -- C++ STL Library book

    Comment

    Working...