Why do we use std;:ofstream
for output and std::ifstream
for input if it is possible to use std::fstream
for both?
This is the similar case as with stringstream, istringstream and ostringsstream (link).
Usually you don't both read and write from the same stream, so using ifstream and ofstream is easier as you don't have to bother about the stream state and stream positions (as is the case with fstream).