Question: I am using ofstream to output something to a file called outFile2, however, when I need to call another function named prettyPrint that I pass

I am using ofstream to output something to a file called outFile2, however, when I need to call another function named "prettyPrint" that I pass in the outFile2 as a parameter in order to read from that outFIle2 again, the error message of "No matching function for call to 'prettyPrint' " shows up.

I first declared ofstream outFile2, then outFile.open(argv[3]);

then I closed it after finished using outFile2.close();

now, I want to reopen it again as a istream to pass into another function as a parameter.

How do you pass the outFile2 as a ifstream into another function as a parameter if it is declared as ofstream before?

This question is surrounding c++.

Thank you!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!