Solved

Losing data from random files

Posted on 2004-08-23
2
177 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A short article about problems I had with the new location API and permissions in Marshmallow
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

861 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now