bad and fail of steam

Discussion in 'C Programming' started by George2, Feb 18, 2008.

  1. George2

    George2

    Joined:
    Feb 12, 2008
    Messages:
    108
    Hello everyone,


    Two questions,

    1. Confused about what is the differences between bad and fail. This what Bjarne's comments in his book, but I do not quite understand and it is appreciated if you could share some best practices of the differences and when to use them.

    --------------------
    The difference between the states fail() and bad() is sutle. When the state is fail() but not also bad(), it is assumed that the stream is uncorrupted and that no characters have been lost. When the state is bad(), all bets are off.
    --------------------

    2. when do you prefer to use bad()/fail() and when do you prefer to use setting exceptions (std::ios::badbit or std::ios::failbit or both).


    thanks in advance,
    George
    George2, Feb 18, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. fernando.cassia@gmail.com
    Replies:
    0
    Views:
    839
    fernando.cassia@gmail.com
    Apr 16, 2005
  2. Wenjie

    if (f() != FAIL) or if (FAIL != f())?

    Wenjie, Jul 28, 2003, in forum: C Programming
    Replies:
    3
    Views:
    417
    E. Robert Tisdale
    Jul 31, 2003
  3. U S Contractors Offering Service A Non-profit

    " Letting off some steam "

    U S Contractors Offering Service A Non-profit, Nov 9, 2006, in forum: C Programming
    Replies:
    0
    Views:
    314
    U S Contractors Offering Service A Non-profit
    Nov 9, 2006
  4. rantingrick
    Replies:
    44
    Views:
    1,146
    Peter Pearson
    Jul 13, 2010
  5. ccc31807

    OT, blowing off steam

    ccc31807, Feb 23, 2010, in forum: Perl Misc
    Replies:
    7
    Views:
    140
    RedGrittyBrick
    Mar 1, 2010
Loading...

Share This Page