You need to have GetFieldText() do 1 of 2 things (it's your choice which)
1) allocate memory, store the text in the allocated memory and return a pointer to this memory. then you have to remember to deallocate it when you don't need it anymore.
2) pass an array of chars that is already allocated into GetFieldText() and store the string there. it would make your header look something like
void GetFieldText( UInt16 objIndex, char *buffer, UInt16 buffer_size )
John Lai wrote:
you're right...but how to modify this function?
Char* GetFieldText(UInt16 objIndex) { FormType *form = FrmGetActiveForm(); FieldType *field; MemHandle h; Char *s = NULL;
field = FrmGetObjectPtr(form, FrmGetObjectIndex(form, objIndex)); if (FldGetTextLength(field) > 0) { FldCompactText(field); h = FldGetTextHandle(field); if (h) { s = MemHandleLock((void *)h); MemHandleUnlock((void *)h); } } return s; }
I'm thinking of passing the char pointer of the object std to the function...like
Char* GetFieldText(UInt16 objIndex, Char *text)
don't know how to re-write it.
_________________________________________________________________
Linguaphone : Learning English? Get Japanese lessons for FREE http://go.msnserver.com/HK/30476.asp
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
