MAYER-A@RICEVM1.BITNET (David Mayer) (07/23/90)
Is there a way I can get a handle to a linked list in memory?? I want to be able to store the list for future use. I am developing a program in THINK Pascal for the Mac. I need a handle to the entire list. It seems like I could get a handle the first record, copy that block elsewhere and append each subsequent record as a block to that one. This seems like a complicated solution, though. Anyone know of an easier way??? --David
dgil@pa.reuter.COM (Dave Gillett) (07/29/90)
In <1723MAYER-A@RICEVM1> MAYER-A@RICEVM1.BITNET (David Mayer) writes: >I need a handle to the entire list. It seems like I could get a handle the >first record, copy that block elsewhere and append each subsequent record >as a block to that one. This seems like a complicated solution, though. >Anyone know of an easier way??? It sounds like what you really want to do is to convert the list to an array; convert the separate items on the list into a single block that contains the entire list. (A nosy part of me has to wonder why. The only advantage I can see to it is to use array indices to jump directly to the Nth item on the list, and your phrasing suggests that's not what you have in mind. So maybe the correct question is: What kind of linked list is it, if a handle to the first item is different from a handle to the entire list??? Think this one through.) Assuming that's what you want to do, I'm pretty sure there's a Toolbox routine that will tack a second handle's contents onto the end of a first handle's, shuffling the blocks around for you. I think you still have to deallocate the old handle yourself, but basically walking the list is all the code you need. Dave