Hello,
It seems that you have forgotten to allocate memory for the aStructure
variable.
TransStruct *aStructure;
aStructure = (TransStruct *) MemPtrNew(sizeof(TransStruct));
if (aStructure)
{
aStructure->Ground[0] = 'u';
}
Of course, don't forget to free the memory when you're done:
if (aStructure)
{
MemPtrFree(aStructure);
}
You probably have a similar error with the earlier code, so maybe look
into that.
Adrien.
Friday, November 4, 2005, 1:53:39 PM, you wrote:
DV> You're right about the global variables. I cut and pasted data from the
DV> vicinity of the global variables instead.
DV> As I've used structures in the past, I declare the structure, then
DV> instantiate an instance of it, which associates that instance with a
DV> variable name.
DV> I then can reference the member variables of the structure by associated
DV> them with the instance of the structure.
DV> I've tried:
DV> TransStruct* aStructure;
aStructure->>Ground[0]='u';
DV> This compiles but creates the error message regarding accessing global
DV> variables when I actually call the function under the emulator.
DV> If I comment out the second of the two lines, the code run's fine,
DV> apparently accepting the other data inputs associated with the structure's
DV> variables.
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/