Solved

Losing data from random files

Posted on 2004-08-23
2
183 Views
Last Modified: 2010-04-17
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

0
Comment
Question by:BIAPRO
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 250 total points
ID: 11875818
try with
DUM$ = DUM$ + Str$(Asc(Mid$(CStr(Myfile.Money), y%, 1)))
0
 

Author Comment

by:BIAPRO
ID: 11876361
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
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
A short article about problems I had with the new location API and permissions in Marshmallow
Simple Linear Regression
Progress

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question