[Wylug-help] C++ Programming Question.

Dave Whiteley d.l.whiteley at ee.leeds.ac.uk
Tue Aug 24 15:46:14 BST 2004


I am panicing....

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));

These are now giving an error of
"Cannot convert from int to char*" for arg 1 of the constructors.


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]])


Please can someone point me at my deliberate mistake.

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