This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ofstream problems


>>>>> "Liam" == Liam Routt <caligari@cs.mu.oz.au> writes:

    Liam> I have recently installed a Mandrake 8.2 linux system and
    Liam> the g++ 3.0.4 that is offered with the
    Liam> distribution. Previously I've been using 2.96.x on linux and
    Liam> a host of other platforms.

    Liam> But I'm having a lot of trouble with the construtors for
    Liam> ofstream (and the rather confusing - to me - errors my
    Liam> attempts are generating).

    Liam> In fstream.h I find:

You are looking at the wrong (old) header, the header where the
basic_ofstream class is declared (ofstream is typedef'ed as
basic_ofstream<char>) is <prefix>/include/g++-v3/bits/std_fstream.h:

  // 27.8.1.8  Template class basic_ofstream
  template<typename _CharT, typename _Traits>
    class basic_ofstream : public basic_ostream<_CharT,_Traits>
    {	
    public:
      // Constructors:
      basic_ofstream()
      : __ostream_type(NULL), _M_filebuf()
      { this->init(&_M_filebuf); }
      
      explicit 
      basic_ofstream(const char* __s, 
                     ios_base::openmode __mode = ios_base::out|ios_base::trunc)

    Liam> Anyone have any solid suggestions for a) why what I'm trying
    Liam> is not working, and b) what I can do to get the same
    Liam> results. It shouldn't be this hard to create a file using
    Liam> ofstreams.

a) gcc already told you: no matching function for call to `std::basic_ofstream<char, 
   std::char_traits<char> >::basic_ofstream(const char*&, std::_Ios_Openmode, int)'
and it also informed you about the alternatives.

b) I think you have to use C system calls to realize what you're
trying to do (unless you use another STL library such as STLPort which
might have this functionality).

HTH
Claudio


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]