Results 1 to 6 of 6

Thread: Opening an open file

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    I have a app that writes a log file as it runs...
    It leaves it open until it is terminated.

    How can I read this file via VB (read only of course)
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  2. #2
    New Member
    Join Date
    Jul 2000
    Posts
    15

    maybe no help

    I know i maybe of no help as i am a big beginner but why dont you just close the file, open it for read, read it, close it again, and open it for append so it carries on where it left off. this probably isnt any help because while you are reading it, it probably wants to be able to write at the same time.

    Alternatively, why donnt you make a copy of the log file every time you ammend it and then you can do what u like with the copy.

    Thirdly, I havent tried this before and probably doesnt work, but can you open the file in random access mode and try reading and writing while it is open?

    hope some of this helps, probably doesnt. sorry im very bored

    If practice makes perfect...

    and nobody's perfect...

    why the hell practice?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    The log file is being generated by someone elses app.

    It writes incomming data there I need to get at the data


    I appreciate the help... I didn't know about Append in VB thanks!
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  4. #4
    Guest
    So you just want to read the file?

    Code:
    Open "C:\app\log.txt" For Input As #1
    Text1.Text = Input$(LOF(1), 1) 
    Close #1

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    The problem is... the file is still open (the other app never closes it)

    I need to read-only on a file that is already open for writing
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  6. #6
    Guest
    Input does read open files. If you want to keep refreshing it, than in a timer, set it's interval to 3000 or something and using that code.

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