Overloaded file

closed account (NUj6URfi)
I used fstream and opened and closed files. I did this so much I overloaded the function. I have many subroutines and need to constantly open and close the file. How can I do this?
You might want to take a step back. Why are you opening and closing the file so much. There's a lot of overhead to do that all the time. It is probably better to have it opened once and keep that handle available for later use.

If you still want to do what you are doing, then you need to give us a clearer understanding of what you are attempting to do. Writing an example to show this would probably help.
I don't understand you.
Try to reword it and put some examples.
Also, ¿couldn't you open the file just one time?
closed account (NUj6URfi)
No because when you call a function you have to reopen the file.
The question is why do you have to reopen the file at every function call? This seems very unnecessary.

Show examples.
closed account (NUj6URfi)
It doesn't work otherwise.
closed account (NUj6URfi)
Tried my 2nd compiler and it worked. Thnx everyone.
Topic archived. No new replies allowed.