Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Stored Variables in a Text File from Multiple Computers 1

Status
Not open for further replies.

wraygun

Programmer
Dec 9, 2001
272
0
0
US
Is it possible for 2 or more computers to access the same text file simultaneously using VB? Only 1 computer would be able to modify the text file, and the other would be able to monitor the contents through an interface. Would there be errors if both computers tried to read at the same time?

***You can't change your past, but you can change your future***
 
Hi

It's no problem to access a text file at the same time. If you open the file for "input", "output" or "append" without the keywords "lock read", "lock write" or "lock read write", the simultaneous access is possible. Because every program/computer uses his own 'copy' of the file, you will never get an error message. You can f.i. read the file (Open "S:\x.txt" For Input As #1) while an other app is writing the same file (Open "S:\x.txt" For Output As #1) and even closes it (Close #1). This works because the Open statement reserves an I/O buffer for the file (see VB Help topic "Open statement").

There's a good article from MS on the web:

HTH
Philipp
 
Thank you. That was exactly the info I needed. A star for you.

***You can't change your past, but you can change your future***
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top