using fstream with multiple files

The fstream examples I have seen always show working with only one file at a time. If I want to have 4 files open at the same time (2 for reading, 2 for writing), how do I designate which file I want to read from or write to?

Hotaru
You can declare different fstream objects and use one for each file:
1
2
3
4
ifstream inputfile ("input.txt");
ofstream outputfile ("output.txt");
inputfile >> somevalue;
outputfile << somevalue;


Topic archived. No new replies allowed.