I’m trying to write a small program that would enable users on different computers to modify the same file (in a directory all users have access to) at the same time and see the changes other users make at the same time. Each time a user modify the file, the change will be saved to the file (.txt) and I used FileSystemWatcher to detect the change and update other users with the change.
I noticed I would get a message saying can’t access the file because another process is accessing it if I try to modify and save the file using notepad while my program is running and accessing the same file. My question is will I get the same error message if after my program is developed and running on DIFFERENT computers? If yes, is there anyway to solve that?
Thanks in advance.
It is possible, but you need to use the full version
System.IO.File.Open()like so, which permits other processes to open the same file for read and write access.