Does this not still open the file? It closes it...which certainly implies it is opened. True, technically it is opened in a particular way, but does it not in fact open it twice? Once for Reading, once again for Writing? Is this not more I/O?
The question was asking how to NOT open it.
And no, you can not change the contents of text in a file without opening it....in some way or another.
Gerry