GetObjectPtr does not return a pointer to a string, if that's what you're
attempting (a snippet of your code would be useful here).

You want something like:
FormPtr frmP = FrmGetActiveForm();
FieldPtr fieldP =
(FieldPtr)FrmGetObjectPtr(frmP,FrmGetObjectIndex(frmP,YourFieldID)); /* put
your field ID here */
CharPtr strFieldData = FldGetTextPtr(fieldP);

Then copy the data out.  If you're sure you've got enough room, just do a
StrCopy(), otherwise use StrNCopy() and make sure you terminate the string.

Jeff

> -----Original Message-----
> From: Matt Becker [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, October 30, 2000 2:46 PM
> To:   Palm Developer Forum
> Subject:      Copying a field's string into a Char array.
> 
> I know this is a pretty simplistic question, but Ill be damned if I can
> get it to work.  All I want to do is copy the contents of a field (a
> string) on the current form into
> char array.  I am not using a DB, it just a simple Char Name[10] I want to
> copy the field into.  But, no matter what I do, I always get  a direct
> read from low memory error
> when I use GetObjectPtr to get the ptr to the string (so I can then use
> StrCopy to copy the field string into the Char array).  I am obviously
> missing something native to the
> PALM thats ok in other platforms,  Please help.
> 
> Thanks in advance
> 
> Matt
> 
> 
> 
> -- 
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/tech/support/forums/

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

Reply via email to