BBS: Inland Empire Archive Date: 05-12-92 (10:47) Number: 87 From: RICK PEDLEY Refer#: NONE To: CHARLIE QUANTE Recvd: NO Subj: saving using bload/bsave Conf: (2) Quik_Bas
On 05-10-92 CHARLIE QUANTE wrote to All... CQ> Hello! CQ> CQ> I posted this as part of an earlier message, and got CQ> no reply. Either my message got lost in the flow, or I've CQ> stumped the talented programmers here. Either way, I CQ> thought I would try once more. What sometimes happens is everyone has seen this question asked many times, so they'll sit back and wait for someone else to answer it. Fortunately, I've saved over a year's worth of useful messages from this echo, so it's just a matter of shelling out to LIST and searching for the code. CQ> I have a program using a 40 by 40 integer array. It is part of a CQ> door CQ> program I wrote, and I read the array info from a CQ> sequential file. It seems to take FOREVER! I saw CQ> something in a book, (unfortunately I can't remember CQ> where), that used BLOAD and BSAVE to load and save a single CQ> dimension array. The address of the first array element was CQ> involved, as well as the total size in bytes of the array. CQ> Would something similar work with a two dimensional array? CQ> How exactly would I code that? Is there a better, quicker CQ> way? Here's a message from Matt Hart that shows how to save and load an array. For a two dimensional array, it's almost the same method, but you have to calculate the number of bytes you need a little differently. First, be sure to specify the upper and lower bounds in your DIM statement, e.g. DIM A%(1 TO 40, 1 TO 20), or at least realize if you don't, you must remember to save the (0,y) & (x,0) elements even if you don't use them for anything. So with the example array above, you'd need 40 * 20 * 2 bytes and if you don't specify the lower bounds, 41 * 21 * 2 to include the zero elements. This'll run so quickly, you'll think it didn't :) Date: 11-19-91 (18:07) Number: 243 From: MATT HART Refer#: 206 To: MIKE AVILA Recvd: NO Subj: Saving Arrays to File Conf: (2) Quik_Bas
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET