Hello Simon,
You could open the file using extra sharing options. More info here:
http://msdn.microsoft.com/en-us/library/d0y914c5.aspx[
^]
There is always a chance that to write processes collide and you have to be ready for that. So you should try a few times before giving up, something like:
int tryCount = 10;
bool haveFileAccess = false;
while (tryCount-- > 0)
{
haveFileAccess = tryOpenFile();
sleep(20);
}
The most important to keep in mind is to keep file access to the absolute minimum. Close the file as soon as you're done with it because it would otherwise keep it locked for other instances to update it.
Another more sophisticated solution would be to create a service that monitors a directory and any file with instructions created is processed into the file. But I guess this is something a bit over the top.
You could also consider using a database. Writing could be done very safely and the reader processes are not bothered by this. They can reconstruct any data by concatenating multiple records together to get the same result as a single file would.
Good luck!