delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/12/31/06:30:09

From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: open() in c++
Date: Tue, 31 Dec 2002 11:20:53 +0000
Lines: 30
Message-ID: <3E117D95.9101A603@phekda.freeserve.co.uk>
References: <200212310422 DOT gBV4MijQ025653 AT chac DOT its DOT uow DOT edu DOT au>
NNTP-Posting-Host: 62.136.88.251
Mime-Version: 1.0
X-Trace: news8.svr.pol.co.uk 1041333781 24240 62.136.88.251 (31 Dec 2002 11:23:01 GMT)
NNTP-Posting-Date: 31 Dec 2002 11:23:01 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello.

Y Chen wrote:
> I don't know why djgpp cannot compile the following sentences(the files are
> at the bottom):
> 
>   char cFilename[101];
>   pFile->open(cFilename, aiMode);
[snip]
> IOBase.cpp: In member function `char TIOBase::OpenFile(std::fstream*, char*,
>    int)':
> IOBase.cpp:123: no matching function for call to `std::basic_fstream<char,
>    std::char_traits<char> >::open(char*&, int&)'
> d:/djgpp/lang/cxx-v3/bits/std_fstream.h:409: candidates are: void
>    std::basic_fstream<_CharT, _Traits>::open(const char*, std::_Ios_Openmode =
>    (std::ios_base::in | std::ios_base::out)) [with _CharT = char, _Traits =
>    std::char_traits<char>]
[snip]

aiMode is the wrong type. It needs to be std::_Ios_Openmode rather than int, I
think.

It's worth trying to understand g++ error messages, even though it can be
tricky. g++ helps you out by suggested function calls that do match -
"candidates are:...".

HTH. Regards,

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019