Is there a way to pass output stream as argument like
void foo (std::ofstream dumFile) {}
I tried that but it gave
error : class "std::basic_ofstream<char, std::char_traits<char>>" has no suitable copy constructor
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
.