Link to home
Start Free TrialLog in
Avatar of jack niekerk
jack niekerkFlag for Netherlands

asked on

Losing data from random files

we have need for still reading 'dos' files created in pds-compiler (basic)
we do this
'at main form
Private Type RFile
  Id As String * 5
  Money As String * 8
 End Type
Dim Myfile As RFile

'load form1

' at test location on form1
Private Sub txtbal_GotFocus()
Dim y As Integer
Dim Myfile As RFile
' this file was created in qbasic compiler  is still needed thats why i want to open it in VB
Open "test.tst" For Random As #12 Len = 13
For i% = 1 To 4
Get #12, i%, Myfile
DUM$ = ""
For y% = 1 To 8
DUM$ = DUM$ + Str$(Asc(Mid$(Myfile.Money, y%, 1)))
Next
Printer.Print i%, Len(Myfile.Id); "/"; Len(Myfile.Money); "/"; DUM$; "/"      
' prints len= 5 and = 8, so len is ok,  but   dum$ contains only chr(0) values
' and i'm sure it contains non-zero chr's
'what wrong?
Next
Close 12
End Sub
Regards Jack

ASKER CERTIFIED SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jack niekerk

ASKER

plus i found out  that the old-dos-programmers habbit,  open a file and like the
old days assuming that windows will open it the file in your 'working' vb-directory is
false, i really  have to say:  open "I:\vbwork\test.tst"  instead of "test.tst"
together it solved.
regards Jack Biapro Aruba