“ofstream” as function argument

Of course there is. Just use reference.
Like that:

void foo (std::ofstream& dumFile) {}

Otherwise the copy constructor will be invoked, but there is no such defined for the class ofstream.

Leave a Comment