SunQuest
           Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old July 8th, 2003, 02:10 PM
strep21 strep21 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 6 strep21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to strep21
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 ?

Reply With Quote
  #2  
Old July 8th, 2003, 10:35 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
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.

Reply With Quote
  #3  
Old July 9th, 2003, 04:14 AM
strep21 strep21 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 6 strep21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to strep21
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
File Type: txt leerling.txt (4.0 KB, 243 views)

Reply With Quote
  #4  
Old July 9th, 2003, 05:59 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
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.

Reply With Quote
  #5  
Old July 9th, 2003, 06:02 PM
strep21 strep21 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 6 strep21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to strep21
Can you tell me how to do that ?
And , is there a way to skip that 4th character in any way ?

Reply With Quote
  #6  
Old July 9th, 2003, 06:11 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
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.

Reply With Quote
  #7  
Old July 9th, 2003, 06:18 PM
strep21 strep21 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 6 strep21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to strep21
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)

Reply With Quote
  #8  
Old July 9th, 2003, 06:27 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 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?

Reply With Quote
  #9  
Old July 9th, 2003, 06:30 PM
strep21 strep21 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 6 strep21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to strep21
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 ?

Reply With Quote
  #10  
Old July 9th, 2003, 06:36 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
I do not see the file.

Reply With Quote
  #11  
Old July 9th, 2003, 06:51 PM
strep21 strep21 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 6 strep21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to strep21
The ascii code of the first 5 characters of the file seem to be 3,2,6,26,1

Reply With Quote
  #12  
Old July 9th, 2003, 07:12 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
Ascii codes or ascii representation?
Here is a list of the ascii representations.
http://www.neurophys.wisc.edu/www/comp/docs/ascii.html

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Vb3 Eof


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway