Results 1 to 3 of 3

Thread: Strange file reading.

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    3
    My program, in one part creates a html document, and in another part reads back in the html code, in order to change filenames, hyperlinks etc.

    The code I use to read in the html document is as follows;

    Open "C:\results\directory.html" For Input As #1
    Do While Not EOF(1) ' Loop until end of file.
    Input #1, sfile, Day ' Read data into two variables.
    sfileName(count) = sfile
    sDate(count) = Day
    count = count + 1
    Loop
    Close #1 ' Close file.

    i.e.
    Read in two lines of html on each pass into two different variables. This code is then passed into an array, followed by incrementing the counter and going around again until EOF.
    The problem is, by about pass 12. (count = 12, this equates to lines 23 and 24)
    the first line of code is read in fine (into sfile)
    However, my program only reads in the first half of the next line of code into the second variable.

    This then causes an error after this, as it reads the second half of this line into the first variable next time around, and as I cant make the file any bigger because of this reason, the program tris to read in nothing into 'Day' variable, giving "input past end of file" error.

    Anybody have any ideas why this happens. It seems like it simply runs out of memory, but I viewed memory constriants through task manager, and that aint happening.

    Any ideas?

    Cheers.


  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    "input past end of file" error And you are using EOF! That can only be one thing:

    Input #1, sfile, Day

    The end of file is between sfile and day. So, either your file is corrupt or you have some "," or other things that Input don't like. I usually don't use Input for reading files so I'm not sure about this.

  3. #3
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    554
    Hi,

    I would have thought that you would be reading the html file back in line by line

    Open Somefile for input as #1
    Do
    If Not EOF(1) Then
    'read next line
    Line Input #1, Buffer
    End If
    Loop Until EOF(1)
    Close #1

    give it a whirl andd try it out
    hope it helps

    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