|
-
Jan 11th, 2006, 01:52 AM
#1
Thread Starter
Lively Member
How Do I Open A File For Read Only That Is Locked
I need to open a txt file for read only while another program updates the txt file.
I have been copying the file with File.Copy() but the txtfile gets up to 5+ megs sometimes and the program becomes really slow.
I tried to use the following code....
FileStream fs = new FileStream(@"c:\results.txt", FileMode.Open, FileAccess.Read, FileShare.Read);
but it gets this error because the txt file is open
The process cannot access the file 'c:\results.txt' because it is being used by another process.
Is there any way open the txt file for read only when it is locked by another process?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|