Depends a lot on what GetFieldText() is doing. Chances are you're not allocating memory to hold the name and ID and just returning a temporary pointer that becomes invalid.

Matt


John Lai wrote:


For simplicity, the following is to get the name from form 1 and get the id from form 2.

////////////////////////////header.h

typedef struct {
char *name;
char *id;
} StudentRecordType;

extern StudentRecordType std; //declare std as a global variable

////////////////////////////form1.c

StudentRecordType std; //define std

void fun1(void)
{
char *name = GetFieldText(Form1NameField); //this function can return the user input value
std.name = name;


FrmGotoForm(Form2Form); //go to form 2
}

////////////////////////////form2.c

void fun2(void)
{
char *id = GetFieldText(Form1IDField); //this function can return the user input value
std.id = id;


//when debugging, I found, name pointer points to anywhere, not the original value.
//write std to DB here
}

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

Reply via email to