Hi,
I am a starter in programming with Palm's SDK for Palm OS, and I am unable
to find any guidelines on how to create and work with dynamic structures
(structs).
For example, I have the following struct declared:
struct data
{
UInt16 referenceID;
Boolean isSelected;
};
Then, I want to create a specified number of instances of type "data" inside
of a "for" loop structure depending on the runtime value of loop's counter
variable. If I were to do this task in standard C++ then, I would have used
the following statement inside of a "for" loop to create such scenario:
data * data_ptr = new data;
The line above would assure that with each loop's iteration, a new memory
location pointed by a pointer of type "data" would be allocated for the
consequent instance of "data". (Later those memory allocations would have to
be explicitly released by "delete").
To do such analogy with Palm OS API, I would have to use "MemPtrNew" API
call to allocate nonmovable chunk of memory, but I still do not see how I
would make that "MemPtr" to become a pointer of type "data" so that my
application could use that pointer to explicitly access variables,
"referenceID" and "isSelected" of struct "data".
Thanks,
Dmitriy Tserekhman.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/