|
-
Oct 16th, 2006, 06:28 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] File Sharing
Hi,
Ok Should be last question for this project. I have Two exes that both read from the same text file and one of the exes writes to it. Also the EXE that reads from it will be on around 10 computers which will all read from the same exe, When I run if I hit it wrong I get an error saying the file is in use.
How can I get it that the exes either ignor the erorr pass over it until the next timer tick (which is not that often)
Or get it so the file can be shared?
M.Carpenter
-
Oct 16th, 2006, 07:00 AM
#2
Hyperactive Member
Re: File Sharing
Hi,
You are not specifying VS version, or which command are you using to open files
anyway I suggest you to open the file (on the thread that is writing) allowing other process to read the file
VB Code:
System.IO.FileStream("C:\yourfile", IO.FileMode.Open, IO.FileAccess.readwrite, IO.FileShare.Read)
Hope this helps
-
Oct 16th, 2006, 07:08 AM
#3
Thread Starter
Frenzied Member
Re: File Sharing
I am using vb .net 05 sorry keep forgetting
and using streamread like:
dim reader as new streamreader = _
new streamreader (path)
readlines
finnaly reader.close
but I have multiple streamreaders in the same timer so what I hcae done is the very first line of the timer is try
then at the end of the timer
catch
timer1.stop
errorcatcher()
then error ctacher does some stuff then starts timer 1 again and it seems to be working
but thanks anyway
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
|