maxLen would be the length of the text buffer pointed to by text. For
instance, if text was char text[64], you would call
GetFieldData(FieldID, text, 63).

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:bounce-450125-
> [EMAIL PROTECTED] On Behalf Of druid
> Sent: Sunday, July 24, 2005 10:41 AM
> To: Palm Developer Forum
> Subject: Re: Checking to see if field has data in it before passing it
> routine
> 
> Here's a better way that has error checking, default processing and
takes
> advantage of a unique feature of the PalmOS "StrNCat()" function to
> prevent
> stack corruption:
> 
> When using a functin like this where does the maxLen
> value come from when passing the data to this function
> 
> Could I also make a change
> 
> 
> Boolean GetFieldData (UInt16 fldNbr, Char *text, UInt16 maxLen) {
> FormPtr pForm = FrmGetActiveForm ();
> FieldPtr pField = FrmGetObjectPtr (pForm, FrmGetObjectIndex
> (pForm, fldNbr));
> if (text != NULL) *text = '\0'; // initialize
> if (text == NULL || pField == NULL)
>  {
>   missing_field = true;
>   return false; // I like error checking !!
>  } // use missing_field to set an aleart window and brake the
>    //static Boolean frmMain_saveButton_OnSelect(EventPtr event)
>    // so as to not allow the save ??
> if (FldGetTextLength (pField))
> StrNCat (text, FldGetTextPtr (pField), maxLen);
> return true;
> }
> 
> 
> --
> 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