Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Types and Files in QB4.5
#1
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)
Reply
#2
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.
Reply
#3
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 Wink
Reply
#4
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. Big Grin
adsherm
Reply
#5
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)
Reply
#6
Sorry SCM, it's a no go in qb45. ;*(

Just tested it.

It only accepts non-dimmed ones.
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)