[Wylug-help] C++ Programming Question.

Dave Whiteley d.l.whiteley at ee.leeds.ac.uk
Wed Aug 25 08:56:46 BST 2004


On Tue, Aug 24, 2004 at 09:56:59PM +0100, Roger Leigh wrote:
> Dave Whiteley <d.l.whiteley at ee.leeds.ac.uk> writes:
>
> > We have some students sitting a resit exam tomorrow, and we have just
> > been checking that the code they have beed asked to study compiles
> > properly, and of course it does not.
> >
> > We have changed the version of cygwin's gcc (g++) that we are using since the
> > original exam and the work involved in downgrading the version would
> > be considerable - and so I wish to avoid it.
> >
> > In the code we had statements:-
> >
> >       infile = new ifstream(fileno(stdin));
> > and
> >       outfile = new ofstream(fileno(stdout));
>
> Neither of these forms are part of the ISC C++ standard.
>
> > These are now giving an error of
> > "Cannot convert from int to char*" for arg 1 of the constructors.
>
> That's correct.  There is no such constructor for a
> std::basic_istream.
>
> > When I look at the manual for ifstream and ofstream I find
> > constructors of the form
> >
> >    ifstream::ifstream (int fd)
> > and
> >    ofstream::ofstream (int fd)
> >
> > as well as
> >
> >    ifstream::ifstream (const char* fname [, int mode [, int prot]])
> >    ofstream::ofstream (const char* fname [, int mode [, int prot]])
>
> Which manual is this.  It's certainly not in the GCC 3.3 or 3.4
> manuals.
>

We were using gcc 2.95 at the time when this code was written and
used.  These quotes were taken from their docs.  We were using C++ in
C compatibility mode - ignoring namespaces.  We have moved on from
then, but this is a resit!

<snip>

Thanks for the code.  However my position is that I need to get the original code, or a near equivalent, working again, because that was what the students were using.

I am now trying to reinstall 2.95 for the exam.




>
> [Perhaps I should have studied programming at Uni!.  I might have
> passed the exam--are the exam papers publicly available after the
> day?]
>
>
> Regards,
> Roger
>
> --
> Roger Leigh
>
>                 Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
>                 GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.


In this case, the exam papers are effectively available before the day!

Dave

--

Dave Whiteley
d.l.whiteley at ee.leeds.ac.uk
Phone +44 (0)113 343 2059
School of Electronic and Electrical Engineering
The University of Leeds. Leeds, LS2 9JT,  UK




More information about the Wylug-help mailing list