|
-
Oct 15th, 2008, 08:47 AM
#1
Thread Starter
Addicted Member
[RESOLVED] [2005] Multiple apps read from same file
Is it possible to have 3 different instances of the same application have a text file open for read only access?
Which type would do it? streamReader or?
-
Oct 15th, 2008, 08:56 AM
#2
Re: [2005] Multiple apps read from same file
I would imagine you could open it for reading as many times as you needed with anything such as StreamReader.
-
Oct 15th, 2008, 09:48 AM
#3
Re: [2005] Multiple apps read from same file
Why have them open? Open the file, read it into memory, close it. Then, even if there was a file access exception, you could wait a second and try again, as none of the programs would ever be reading the file for long.
My usual boring signature: Nothing
 
-
Oct 15th, 2008, 10:13 AM
#4
Thread Starter
Addicted Member
Re: [2005] Multiple apps read from same file
Well they all launch within a minute or two of each other, and if the file is left stuck open by one of the programs, I wanted the others to be able to read it.
-
Oct 15th, 2008, 10:22 AM
#5
Re: [2005] Multiple apps read from same file
Still, open-read-close. Do that within a Try...Catch block, and if you can't open wait for a second or so. Reading smaller files is so fast that you shouldn't have any collisions in a minute or two, or even a second or two, but if the files are HUGE, that could be an issue. I don't know whether you can have a file open for read only multiple times. It should be possible, but that comes down to OS design, I would think.
My usual boring signature: Nothing
 
-
Oct 16th, 2008, 08:40 AM
#6
Re: [2005] Multiple apps read from same file
Use a SyncLock block perform operations on the file.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Oct 16th, 2008, 08:46 AM
#7
Thread Starter
Addicted Member
Re: [2005] Multiple apps read from same file
I'm going to mark this thread as resolved, as it will be a few days of testing to see if the issue is still there or not. Rather not leave it up for now.
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
|