0

I'm having a weird issue with a proprietary software system. Anyways, I think the only question I need answered is "can two processes in a .NET environment read from the same text file (file I/O) at the same time without error"? The file in question is a 3gb CSV file.

Mike Marks
  • 10,017
  • 17
  • 69
  • 128
  • Yes, absolutely, provided the file is opened with the correct sharing modes (otherwise you will get a sharing violation error when trying to open from the second app). – 500 - Internal Server Error Oct 16 '14 at 14:44
  • Thanks @500-InternalServerError, I forgot to mention though, The file in question is a 3gb CSV file. Would this cause any issues? – Mike Marks Oct 16 '14 at 14:45
  • No, the size of the file should not be a factor in this. What's the error you are getting? – 500 - Internal Server Error Oct 16 '14 at 14:46
  • "Cannot read from a closed TextReader" - I don't have access to the source code so I cannot get any more details than this. – Mike Marks Oct 16 '14 at 15:02
  • @500-InternalServerError this error isn't consistent. It's a weird one off error. Most times I don't get any errors. – Mike Marks Oct 16 '14 at 15:04
  • Sorry for being so vague, but my role isn't that of a developer anymore, so this is really all the information I have. I understand that the answer I get will probably also be vague, and that's fine, just looking for a general direction. – Mike Marks Oct 16 '14 at 15:05

1 Answers1

0

You can open the file with FileAccess.Read and FileShare.ReadWrite mode.

Check out this question: How can I read a text file without locking it?

Community
  • 1
  • 1
Alireza
  • 10,237
  • 6
  • 43
  • 59
  • Right, I don't have access to modify or access the source code - my role isn't that of a developer anymore, so I guess I was asking more along the lines of generality. – Mike Marks Oct 16 '14 at 15:09