switching to ofstream in c++ for all output