On 9/21/06, Jeff Loucks <[EMAIL PROTECTED]> wrote:
Not PalmProgramming Companion, but C language.
You are correct. Pointers are simply the address of something. Each
character in memory has a distinct address. A NUL terminated string is
a contiguous sequence of characters in memory, the last being a NUL. A
pointer to the string would be the address of the first character in
the string.
What he suggests is that you place the entire string somewhere that
persists, like within the structure you return, then scan through the
string, remembering where each interesting part of the string starts.
Use a pointer to scan through the string. The pointer would initially
point to the first character of the string. As you move through the
string and find interesting portions, assign the address of that
portion (the current scan pointer) to the appropriate character
pointer in the returned structure. For example, if you have located
the beginning of the UTC portion, set GPSData.GPSUTC = scanPointer.
Additionally, as you encounter a comma, replace it with the NUL
character. This will terminate the sequence of characters immediately
preceeding the replaced comma. When you are finished, you will have
converted the single string into a collection of smaller strings, and
you'll have a set of pointers to each one of them that you found
interesting.
thanks jeff - you just wrote the documentation for the code i posted.
hehe :)
--
// Aaron Ardiri
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/