Del Ventruella wrote:
GLOBAL VARIABLES
typedef struct {
char Name[10];
char IDorY[2];
UInt16 ANUM;
} TransStruct;
typedef TransStruct TransStructType;
typedef TransStruct* TransStructPtr;
None of these are global variables. They're all type declarations.
DmOpenRef gTdata;
Now that's a global variable.
SUBROUTINE TO GET DATA FROM FIELDS ON FORM
AND ENTER INTO A STRUCTURE TO LATER BE STORED
IN A RECORD
Err TrFormGet(TransStruct* aRecord)
{
FormType* frmP = FrmGetActiveForm();
Err err=0;
Char* Text;
TransStruct* aStructure;
Char* IntegerT = (Char*) MemPtrNew(maxStrIToALen);
UInt16 test;
//Get pointer to field into which data is to be placed
FieldType * field = (FieldType*)GetObjectPtr(TName);
//get data from record structure passed to function
aRecord->IDorY[0]='u';
You haven't given any information about the value of the
aRecord pointer, which was ultimately the question. If
this pointer doesn't point to a valid instance of a
TransStruct, then you will probably get a crash.
Incidentally, your typedefs above are a bit redundant. It
would be simpler to do this:
typedef struct TransStruct {
char Name[10];
char IDorY[2];
UInt16 ANUM;
} TransStructType;
typedef TransStructType* TransStructPtr;
However, what you have right now won't cause a crash of course.
- Logan
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/