PDA

Click to See Complete Forum and Search --> : Input from File


RogerH
Jan 1st, 2000, 12:48 AM
Check out this:


Dim Count1 As Long
Dim FileName As String
Dim FileHandle As Long

FileName = "C:\temp\test.txt"
FileHandle = FreeFile 'Use this instead of a fixed number!
Open FileName For Random As #FileHandle Len = 15

'EOF gives back False (0) as long as
'your not at the enf of file!
Count1 = 0
Do While Not EOF(FileHandle)
Count1 = Count1 + 1
'Rest of processing...
Loop

Close #FileHandle


Hope it helps
Roger

[This message has been edited by RogerH (edited 01-01-2000).]

Seeker870
Jan 1st, 2000, 11:30 AM
Private Sub Form Load()
Dim Count1 as Integer
Dim Count2 as Integer

[Other Preps deleted]

FileName = App.Path & "\MArt.txt"
Open FileName for Random as #1 Len = 153
For Count1 = 1 to EOF(1)
'[STOPS]
Get #1, Count1, FVars
'FVars is a fixed length string variable
Count2 = Count2 + 1
Next Count1
If Count2 < 0 Then

[Deleted]

End If
If Count2 > 0 Then
ReDim MArti(23, Count2)
For Count1 = 1 to EOF(1)
Get #1, Count1, FVars
'Break FVars down into Fixed length variable with Mid$
'Move From Variable into MArti Array
Next Count1
Close
End Sub

This section is designed to open a file, read in a bunch of information and then allow the user to manupliate the info. Simple and straightforwards.
However, regardless of whether there is any info in the file or not the program always [STOPS] as though it receives EOF(1).
The save routine saves the information upon exiting the program, and works perfectly, as far as I can tell. Even after open up the file with a another text reader, everything seems to be in order.
Anyone have any ideas whats going on?