|
Hi James - >alloc sizeof(strdata) ptr > >and get the first occurence of strdata. Then I ought to be able to > >alloc sizeof(strdata) ptr > >and get another occurence of strdata, or the second occurence. Unless you save the value of the pointer, when you do the second ALLOC, you will lose the pointer to the first memory area. If you want to use separate ALLOCs, then you need an array of pointers, which gets you right back to where you started from. What you want to do is ALLOC a memory area, then REALLOC to increase the size of the memory area. This keeps all of your occurrences contiguous. Then all you need is two pointers, one to point to the start of memory and one to point to the occurrence that you want to work with. (You can actually do it with one, but if you are not extremely careful, you will lose your place.) You use a single-occurrence data structure based on the second pointer. A little pointer arithmetic gets you to whatever occurrence you want, without bounds. This way you can have as many occurrences as you can fit in whatever the maximum amount of memory is that can be ALLOCated/REALLOCated in one chunk, which happens to be 16MB. Ken Southern Wine and Spirits of Nevada, Inc. Opinions expressed are my own and do not necessarily represent the views of my employer or anyone in their right mind. +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.