8 Replies
You need to change the FileShare property.
using (FileStream stream = new FileStream("file.txt", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
// Read from or write to the file here
}
Sorry mobile
Do that in the first application, then the second one will be able to access it
there is no second or first application. I dont have access to the source code of whatever application is accessing that file to change that lol.
Hmm
all i have is my application which is trying to write to a text file thats all
Please do not use
ArrayList
, it is rudiment from the pre-generic era, stick to List<T>
I think your only option is to wait for the first application to quit using the file
I don’t think there’s any work around
Both apps need to specify
FileShare
, otherwise OS will not allow accessing file concurrentlyoh alright that makes sense
thanks