fclosall() and std::ofstream?

Discussion in 'C++' started by Dave Johansen, Mar 18, 2008.

  1. Is it ok to call fcloseall() when using both C-style FILE * and C++
    std::eek:fstream's to read files in a program?
    Thanks,
    Dave
    Dave Johansen, Mar 18, 2008
    #1
    1. Advertising

  2. Dave Johansen

    Jack Klein Guest

    On Tue, 18 Mar 2008 11:20:26 -0700 (PDT), Dave Johansen
    <> wrote in comp.lang.c++:

    > Is it ok to call fcloseall() when using both C-style FILE * and C++
    > std::eek:fstream's to read files in a program?
    > Thanks,
    > Dave


    No idea. There is no "fcloseall()" function in either the standard C
    or the standard C++ library. So you will have to consult the provider
    to find out what it does or does not do.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://c-faq.com/
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
    Jack Klein, Mar 19, 2008
    #2
    1. Advertising

  3. On Mar 18, 6:45 pm, Jack Klein <> wrote:
    > On Tue, 18 Mar 2008 11:20:26 -0700 (PDT), Dave Johansen
    > <> wrote in comp.lang.c++:
    >
    > > Is it ok to call fcloseall() when using both C-style FILE * and C++
    > > std::eek:fstream's to read files in a program?
    > > Thanks,
    > > Dave

    >
    > No idea.  There is no "fcloseall()" function in either the standard C
    > or the standard C++ library.  So you will have to consult the provider
    > to find out what it does or does not do.
    >
    > --
    > Jack Klein
    > Home:http://JK-Technology.Com
    > FAQs for
    > comp.lang.chttp://c-faq.com/
    > comp.lang.c++http://www.parashift.com/c -faq-lite/
    > alt.comp.lang.learn.c-c++http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html


    I did a little more research and it is actually a GNU and Microsoft
    extension, but it causes problems when using static/global fstream's
    because the destructors try to close the FILE * that has already been
    closed.

    Dave
    Dave Johansen, Mar 19, 2008
    #3
    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. red floyd

    std::ofstream filename

    red floyd, Aug 14, 2003, in forum: C++
    Replies:
    1
    Views:
    5,573
    Thomas Matthews
    Aug 14, 2003
  2. Squid Seven

    ofstream * vs. ofstream

    Squid Seven, Jul 13, 2005, in forum: C++
    Replies:
    5
    Views:
    595
    Ivan Johansen
    Jul 14, 2005
  3. Replies:
    8
    Views:
    1,431
  4. thinktwice
    Replies:
    2
    Views:
    754
    thinktwice
    Aug 25, 2006
  5. William Xu
    Replies:
    4
    Views:
    3,748
    William Xu
    Feb 25, 2008
Loading...

Share This Page