Q: how to get the error from fstream <<

Discussion in 'C++' started by zhou, Jul 23, 2003.

  1. zhou

    zhou Guest

    Hi there,

    I got an error when writing to a file via ofstream. Is there a way to get detailed reason for the error?
    iosstate only has bad and good bits, no good enough to tell me what went wrong.

    ofstream fs;
    fs.open("aaa");
    if ( fs << ....) {
    // error
    }

    Thanks.

    Yan
    zhou, Jul 23, 2003
    #1
    1. Advertising

  2. Re: how to get the error from fstream <<

    "zhou" <> wrote in message
    news:bfmtgh$g9d4g$-berlin.de...
    > Hi there,
    >
    > I got an error when writing to a file via ofstream. Is there a way to get

    detailed reason for the error?
    > iosstate only has bad and good bits, no good enough to tell me what went

    wrong.
    >
    > ofstream fs;
    > fs.open("aaa");
    > if ( fs << ....) {
    > // error
    > }
    >
    > Thanks.
    >
    > Yan


    No, there is no portable way to get a detailed reason for the error.

    john
    John Harrison, Jul 23, 2003
    #2
    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. Armando
    Replies:
    6
    Views:
    730
    Armando
    Jan 29, 2004
  2. Pasacco
    Replies:
    1
    Views:
    1,517
    Victor Bazarov
    Apr 1, 2005
  3. Replies:
    3
    Views:
    3,478
    Jon Bell
    May 29, 2005
  4. ratzeel

    fstream error on SUN

    ratzeel, Nov 8, 2005, in forum: C++
    Replies:
    3
    Views:
    323
  5. ZikO
    Replies:
    3
    Views:
    6,248
    James Kanze
    Feb 5, 2009
Loading...

Share This Page