Results 1 to 4 of 4

Thread: Opening and reading a remote txt file

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Dayton, OH USA
    Posts
    119

    Question

    I have a vb application that will go out and read a log\txt file sitting on a remote server. The file size is approximately 500 bytes so it is relatively small. The problem I am having is that it can take in upwards of 1 minute to read line by line of the file and return it back to a vb window on the client. My question is how can I speed this process up. Here is my code below:

    CommonDialog.FileName = "\\<unc file path>\log.txt"
    Open CommonDialog.FileName For Input As #1
    Do Until EOF(1)
    Line Input #1, LineOfText$
    AllText$ = AllText$ & LineOfText$ & Wrap$
    Loop
    txtLog.Text = AllText$

    Any suggestions would be greatly appreciated!

  2. #2
    Lively Member
    Join Date
    Sep 1999
    Location
    Liverpool, UK
    Posts
    64
    Can't you make a copy of the file, save it in the windows temp folder locally and read it from there instead ?

  3. #3
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    Read the data into an array and do the string manipulation after you have closed the file, also you may want to use INPUT# since this reads a line at a time into a variable instead of a character at a time (as LINE INPUT does)

    Cheers,

    Paul.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  4. #4
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Open the file for binary, it's much faster... check out the File tutorial on kedaman's hp (www.kedaman.com), it helped me alot!
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

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