Hi all,
IM currently programming good old ANSI C for a PALM application. My problem is i have a global var in the form of an array containing several structs.
For the sake of simplicity and to save the current settings the user might have entered previously, i make a copy of the current struct he wants to modify (typedef struct {...} medication

from the array "normal_medications" to a new standalone var called "current_medication".
Problem is, it seems its copying a pointer of the struct from the array into my standalone variable. Needless to say that this can't work since my main objective is to have a temp copy of this item at hand.
So i tried to copy each element of the struct manually item by item but it still copies pointers to these items. I'm clueless as to what to do. I remember from a long time ago that there is supposed to be an operator in the assignement i can use to force a copy of this item to be passed from the array to my standalone variable.
Here is some code that can help you understand my prob:
MAIN.C
-------
medication normal_start[4];
MAIN.H
-------
//A product chosen in the start portion is described by these params
typedef struct {
Boolean hasBeenInit; //SelfExplains
Boolean substSet; //Since 0 is still valid for subst, we need a flag to make sure it's been set
Boolean stypeSet; //Since 0 is still valid for stype, we need a flag to make sure it's been set
Boolean vaSet; //Since 0 is still valid for va, we need a flag to make sure it's been set
UInt16 subst; //Contains a substance (See defines below)
UInt16 va; //Contains the VA(See defines below)
UInt16 stype; //Contains the stype (See defines below)
char name[32]; //Contains the commercial name of the product chosen
double dosage; //Contains the dose administered
char finalconstr[32]; //Contains the final constructed string
} medication;
MEDFORM.C
-----------
...
...
extern medication normal_start[4];
medication current_medication;
....
....
switch(curMedFormState.substatepos){
case state_main:
current_medication = normal_start[curMedFormState.medicationIndex];
break;
case state_interdose:
current_medication = interdose_start[curMedFormState.medicationIndex];
break;
}
....
....