file lock?

  • Thread starter Thread starter RP
  • Start date Start date
R

RP

Hi all, I was wondering if it is possible to place a lock on a text file,
while opening in write mode so that no other processes/threads can even read
the file until current process is done and releases the lock?

TIA,
RP
 
RP said:
Hi all, I was wondering if it is possible to place a lock on a text file,
while opening in write mode so that no other processes/threads can even read
the file until current process is done and releases the lock?


dim f as New IO.FileStream("c:\foo.txt",IO.FileMode.Open,
IO.FileAccess.ReadWrite, IO.FileShare.None )

Until f.close, you have exclusive acess to the file.

David
 
thanks

David Browne said:
dim f as New IO.FileStream("c:\foo.txt",IO.FileMode.Open,
IO.FileAccess.ReadWrite, IO.FileShare.None )

Until f.close, you have exclusive acess to the file.

David
 
Back
Top