Thread: Vb3 Eof

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    6
    Rep Power
    0

    Vb3 Eof


    After more then 8 years I am trying to make a very small application.
    I want to read sequential data files created by another application, and write parts of it to disk in order to do further analysis.
    Now, one of the files, which I am 100% sure is used by the original application, gives and EOF error when I try to read beyond the 3rd character.
    LOF says the file is 4136 !
    So I don't understand what is happening here. Any suggestions to read beyond that 'reported' EOF ?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    Is the file in use when you are attempting to read it? Have you manually verified the data in the file? Have you verified that your code can read other files? If you post the routine somebody may notice that may help you.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    6
    Rep Power
    0
    Thanks for your response.
    The file is not in use when i try to read it.
    The (very simple) code can read other files without problems.
    When I load the file in e.g. Word, and delete the 4th character (can't tell what it is"), save it again, the code reads it without problems.
    I have attached the file in case someone might try to read it.
    The code :

    Sub BestandLezenNaam ()
    Dim test$, teken$
    Dim EindeNaam
    Dim x, m, n As Integer
    test$ = ""
    InhoudBestand.Text = ""
    Open "LEERLING.TXT" For Input As #3
    Open "leer_New.txt" For Output As #4

    For x = 1 To 2691 'skip 2691 chars
    teken$ = Input$(1, #3)
    Next x

    For x = 1 To 12
    teken$ = Input$(1, #3)
    test$ = test$ + teken$
    Print #4, teken$;
    Next x

    Print #4,

    For m = 1 To 34
    For n = 1 To 25
    If EOF(3) Then GoTo EindeNaam
    teken$ = Input$(1, #3)
    test$ = test$ + teken$
    Print #4, teken$;
    Next n

    Print #4,
    Next m

    EindeNaam:
    InhoudBestand.Text = test$
    End Sub
    Attached Files
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    You said that you were able to manully delete the fourth character and the script runs fine. I would check the data being read and see if that is an escape or control character.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    6
    Rep Power
    0
    Can you tell me how to do that ?
    And , is there a way to skip that 4th character in any way ?
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    The chr() function will return the ascii value of the character. As you are going through the file read the characters and print out the values to the immediate window.
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    6
    Rep Power
    0
    I can't recognize what character it is, since I can't read the file in Visual Basic. I just could delete the character after opening the file in Word (looks like an open rectangle)
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    Did you attempt to read the character? If you are unable to read the character it may be beyond the ASCII 255 range. Was the file created by a user or imported from some other source?
  16. #9
  17. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    6
    Rep Power
    0
    Attempted but didn't work. File is imported from other source. Other files from that same source ( with other type of information ) can be read without problems. I attached the file I am talking about. Could you maybe download it and try yourself ?
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    I do not see the file.
  20. #11
  21. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    6
    Rep Power
    0
    The ascii code of the first 5 characters of the file seem to be 3,2,6,26,1
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    Ascii codes or ascii representation?
    Here is a list of the ascii representations.
    http://www.neurophys.wisc.edu/www/comp/docs/ascii.html

IMN logo majestic logo threadwatch logo seochat tools logo