Passing ofstream object to another function
Hi, need some help here.
i have an idea of -
i am trying to make it into functions so that i can have multiple threads writing to the file using the same stream. i understand that declaring the ofstream variable as global will be one solution. however, due to requirements, that cannot be done.
void openFile(ofstream var_ofs)
void writeFile(ofstream var_ofs)
how can this be done without using global variables? i have tried passing the ofstream as pointer but that wouldn't work too.