Results 1 to 3 of 3

Thread: Open File for Write by Several EXEs

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Atlanta, GA
    Posts
    80

    Question

    Is there a way that I can open a txt file for use by several instances of the same EXE?

    I have Program1.exe that monitors the number of Program2.exe instances that are running. If less than 10 instances, a new one is started. When Program2.exe is finished processing, it Ends.

    This runs Program2.EXE 118 times @ 10 concurrent "Connections" at a time.

    I would like for all 10 instances to write to a txt (Log) file without fear of a file lock by any of the others.

    Can this be done?

    Thanks,
    Kevin Sutton

    VB6 Professional w/SP4

  2. #2
    Guest
    Code:
    Open "C:\app\log.txt" For Output As #1
    Print #1, "text"
    Close #1
    
    If you want to write more information to the end of a file:
    
    Open "C:\app\log.txt" For Append As #1
    Print #1, "text"
    Close #1

  3. #3
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    554
    I do believe that if the file is open for Rando Access then it may re-opened on another channel, without closing the file first.

    Code:
    ie
    Open myFile For Random As #1 Len = Len(myRecord)
    Open myFile For Random As #2 Len = Len(myRecord)
    etc
    DocZaf
    {;->






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