Hello Monks,
I have the following function calls:
main_func is opening a file and writing one line to it. Then main_func calls sub_func1 and after that sub_func2, which are in other modules. Afterwards main_func writes one more line into the file and then closes the file.
You see at the moment I open the file once in main_func and close it also in main_func. The function sub_func1 and sub_func2 do not open the file. They just get the file_handle of the file via a parameter and write to the file. Let's call this solution 1.
The other solution, let's call it solution 2, would be to open the file for writing in main_func, then write one line, close it. Then call sub_func1, open the file for appending, write some stuff into it, close it. Then sub_func2 is called. Opens the file for appending, writing some stuff, closing the file. Then main func opens the file for appending, writes one line into it, closes it.
What is the better solution? 1 or 2?
Now I have to add something to the current behaviour. After the call to sub_func1 I have to modify the file by moving one line to another position in the file. And then sub_func2 is called and everything goes on as before. I think that this kills solution 1. What would you suggest?
I'm just interested what is your meaning to this.
Thank you
Dirk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |