FILE* in c++ ?

Hi, I'm working on a school assignment and I've run across what I believe to be a conflict in the requirements. The assignment states "You must only use C++ style input and output to files and the console". I was provided a few class header files for which I need to write the implementations. However, one of the classes contains a member FILE*. As far as I know there is no way to use an [io]fstream with a FILE*. Is that correct? If so, I will simply use fprintf and argue the point with my professor.
You are correct, FILE* is C style input and output while fstream is C++. I would ask the professor if the assignment was improperly explained.
Given the "must" in the statement

"You must only use C++ style input and output to files and the console"

maybe you should repair the header instead? (marking repair with comment that refers to the above requirement)

Last edited on
Yeah it's a tough call because there's also a statement: "You MUST use this code without modification: no code added or removed and no macros." <-- the bolding is how it's done on the assignment paper :p

So, I think I'm just going to use fprintf for now, and take it up with the prof later.

Thanks for the help :)
Last edited on
Might be part of the assignment?
Last edited on
Maybe the answer's "not possible due to inconsistent requirements" ??

The problem with the FILE*, is that it could well subvert a lot of other code? Is it possible to just ignore it?
I think it was honestly just a mistake. This assignment is supposed to be a C++ rewrite of an earlier C assignment, and a lot of things are clearly copy pasted without much thought.
Topic archived. No new replies allowed.