|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
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.
|
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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.
|
|
#5
|
|||
|
|||
|
Can you tell me how to do that ?
And , is there a way to skip that 4th character in any way ? |
|
#6
|
|||
|
|||
|
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.
|
|
#7
|
|||
|
|||
|
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)
|
|
#8
|
|||
|
|||
|
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?
|
|
#9
|
|||
|
|||
|
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 ?
|
|
#10
|
|||
|
|||
|
I do not see the file.
|
|
#11
|
|||
|
|||
|
The ascii code of the first 5 characters of the file seem to be 3,2,6,26,1
|
|
#12
|
|||
|
|||
|
Ascii codes or ascii representation?
Here is a list of the ascii representations. http://www.neurophys.wisc.edu/www/comp/docs/ascii.html |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Vb3 Eof |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|