+ 1
How to modify a txt file even when it is open in a c++ program?
2 Answers
+ 1
You can only modify a file by opening it first.
Maybe you meant when it is open in another program? In that case, you can't and shouln't be able to anyway. Several programs modifying a file at the same time would just erase the changes of the other when saving if this was allowed.
0
What Zen mentioned is the classic reader/writer problem from computer science. You'll encounter it not only writing to a file. The file can be considered shared memory between two operation system processes. You'll pretty much encounter it every time you have to share memory.