You need to pass in a FileShare
enumeration value of None
to open on the FileStream
constructor overloads:
fs = new FileStream(@"C:\Users\Juan Luis\Desktop\corte.txt", FileMode.Open,
FileAccess.ReadWrite, FileShare.None);
More Related Contents:
- Parsing CSV files in C#, with header
- How to check for file lock? [duplicate]
- How to add a Timeout to Console.ReadLine()?
- Why is access to the path denied?
- Calculate the execution time of a method
- Cannot delete directory with Directory.Delete(path, true)
- Save and load MemoryStream to/from a file
- Wait Until File Is Completely Written
- Using FileSystemWatcher to monitor a directory
- What is the difference between Directory.EnumerateFiles vs Directory.GetFiles?
- How to find and replace text in a file
- Read binary file into a struct
- Add a new line at a specific position in a text file.
- How to find out if a file exists in C# / .NET?
- open file in exclusive mode in C#
- Does FileStream.Dispose close the file immediately?
- Write to a file from multiple threads asynchronously c#
- File.ReadLines without locking it?
- Using async / await with DataReader ? ( without middle buffers!)
- Filesystem watcher and large files
- How can I split (copy) a Stream in .NET?
- Why does System.IO.File.Exists(string path) return false?
- How do I use DateTime.TryParse with a Nullable?
- Insert spaces between words on a camel-cased token [duplicate]
- C# 4: Real-World Example of Dynamic Types
- Where is a good Address Parser [closed]
- WPF WebBrowser (3.5 SP1) Always on top – other suggestion to display HTML in WPF
- Regex for extracting certain part of a String
- Auto print without dialog
- String interpolation in a Razor view?