GLOBAL VARIABLES

typedef struct {
 char Name[10];
 char IDorY[2];
 UInt16 ANUM;
 } TransStruct;
typedef TransStruct   TransStructType;
typedef TransStruct*  TransStructPtr;

DmOpenRef gTdata;


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';

etc.


----- Original Message ----- 
From: "Dean Gahlon" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[email protected]>
Cc: "Dean Gahlon" <[EMAIL PROTECTED]>
Sent: Friday, November 04, 2005 1:50 PM
Subject: Re: I hate to ask


> > I declared the structure as a Global variable.  It is the structure for
the
> > database records.
> >
> > I try to load a string into one of the character arrays, and get an
error
> > message
> >
> > telling me that I am accessing reserved Global memory incorrectly.
> >
> > ----- Original Message ----- 
> > From: "Ben Combee" <[EMAIL PROTECTED]>
> > To: "Palm Developer Forum" <[email protected]>
> > Sent: Friday, November 04, 2005 1:02 PM
> > Subject: Re: I hate to ask
> >
> >
> > > At 11:44 AM 11/4/2005, you wrote:
> > > >I am trying to set the first character in a char array within a
structure
> > > >equal to a character using:
> > > >
> > > >aRecord->Ground[0] = 'u';
> > > >
> > > >When I run this, the compiler tells me that I'm accessing memory
> > > >incorrectly, and should use special means of accessing memory.
> > >
> > > This should work, unless aRecord is on the storage heap.  In that
case,
> > you
> > > need to write something like
> > >
> > > DmWrite(aRecord, offsetof(aRecord, Ground[0]), "u", 1);
> > >
> > > (that's approximate syntax)
> > >
>
> In your code, what has aRecord been set to?
>
> Without seeing the code, it's hard to know what's going on, but
> aRecord needs to point to your global variable, or to storage of the
> appropriate type that's been allocated.
>
> -- 
> For information on using the PalmSource Developer Forums, or to
unsubscribe, please see http://www.palmos.com/dev/support/forums/
>

-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to