Results 1 to 2 of 2

Thread: Reading/Adding text file without locking it

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Question Reading/Adding text file without locking it

    Hi Everyone,

    I have a few of the same programs that need to add a line of text to the same text file. And I have one main program that will read this file and load the lines in to it and clear it out. If one is adding to it while the other tries to read it, will that cause an error? Could I just use error trapping to prevent the program from crashing? I plan to use the Open statement like below to access the file both ways:

    Code:
    Open strFile For Input As #nFile
    Basically what I need to do is get the IP address from several computers on the network as they go online. So I was going to have each computer write it's computer name and IP address to a file at a place on the network where they all have access. Then my main program will read this in. I don't know any other way to do it. I can't have them connect to the main program because they may not have access to where the main program is running. So I need a central location for this.

    I thought of putting an access database in this central location and have all of the programs just update their record. But Do I need to worry about record locking since more than one computer will access the single table? The program is too small to deal with SQL Express.

    Thanks!

  2. #2
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431

    Re: Reading/Adding text file without locking it

    You could avoid the whole issue by having the programs write a new text file named according to their IP address, for example 127.0.0.1.txt and 127.0.0.2.txt. The file system shouldn't mind so long as you don't have thousands of computers turning on and off all the time.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width