i have two programs working on the same file
i want the first program to check regularly on the file, and if any changes are made operate on the file and empty it.
the other program writes to the file.
the problem occurs when the second program tries to write on the file because it’s used from the first one
is there an (if there’s any implemented C# program would be even better) algorithm to handle this?
i have two programs working on the same file i want the first program
Share
To check if file has changed you might first of all check its timestamp. In pseudo code, you might try something like this in the monitoring program:
However, I would strongly recommend a different approach altogether. Here are the options I’d suggest.