Writing to files from outside the function they were opened in

This is a discussion on Writing to files from outside the function they were opened in within the C++ Programming forums, part of the General Programming Boards category; Is there any way of doing this?
I need to open up an output text file in the main function ...

Writing to files from outside the function they were opened in

Is there any way of doing this?

I need to open up an output text file in the main function (where argv is) and then write to it from within a function called by main, yyparse(void). This function is generated by bison and I don't know any way of adding parameters to it.