Posts: 309
Threads: 15
Joined: Jul 2003
I ues 7.1. This means that I can have an array within a user defined type
Code:
TYPE RecordType
name AS STRING * 10
time AS INTEGER
moves AS INTEGER
END TYPE
TYPE ListType
record(10) AS RecordType
END TYPE
which allows me to GET (or PUT) an entire list from (or to) a file at once. If I want my programs to be 4.5 compatible, is there another way to accomplish the same thing?
hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)
For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
Posts: 1,272
Threads: 36
Joined: Feb 2003
You'd have to use DOS interrupts with INTERRUPTX to read from the file into the array. Or use BLOAD/BSAVE. Or you can read the data into a string and copy it to the array with PEEK/POKE.
Posts: 1,845
Threads: 44
Joined: Aug 2002
SCM:
You mean something like this? :
Code:
TYPE RecordType
name AS STRING * 10
time AS INTEGER
moves AS INTEGER
END TYPE
DIM record(9) AS RecordType
'get array module
FOR I = LBOUND(record) TO UBOUND(record)
GET ###, , record(I)
NEXT I
As Sterling already said, you can also use a dos interrupt 21h, ax=3Fh. Here's the link:
http://www.ctyme.com/intr/rb-2783.htm. Beware to use int 21h, ax=3Dh at
http://www.ctyme.com/intr/rb-2779.htm and int 21h, ax=3Eh at
http://www.ctyme.com/intr/rb-2782.htm as well.
Hope it works
Posts: 75
Threads: 11
Joined: Nov 2003
I use QB 4.5, and it's done the same way as you have it. No need for the DOS interrupts or anything else.
adsherm
Posts: 309
Threads: 15
Joined: Jul 2003
Dadsherm,
It is nearly the same, but I don't think you can't have an array in a Type block in 4.5.
Neo,
The FOR loop was the obvious solution, but I was wondering if there was another way. I'll check your links. I've never used any low level code, but it's about time I started learning.
Sterling,
I don't think that BLOAD will work because I plan to have several lists in the file. I'll look up INTERRUPTX.
hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)
For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
Posts: 3,288
Threads: 167
Joined: Nov 2001
Sorry SCM, it's a no go in qb45. ;*(
Just tested it.
It only accepts non-dimmed ones.