+ 1

How to modify a txt file even when it is open in a c++ program?

1st Sep 2016, 1:45 AM
Adarsh
Adarsh - avatar
2 ответов
+ 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.
1st Sep 2016, 7:25 AM
Zen
Zen - avatar
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.
3rd Sep 2016, 10:22 AM
Stefan
Stefan - avatar