> in your examples > DmStrCopy (reportdbptr, 0, newReport.str); > -or- > DmWrite(reportdbprt, 0, newReport.str, > StrLen(newReport.str)); > > newReport.str is still a char pointer (char* str). > This isnt what you mean, > right?
I think you should get a good book on C programming and study it a bit before going much further with Palm OS programming. In C, a string is represented as a sequence of characters with a terminating null character (/0). (e.g., 'J','o','e', /0) There is no string data type, like in Pascal. When you declare Char * str, you are declaring str to be a pointer to a Char, but you aren't allocating any space to store the string. On the Palm OS, you have two (actually more) ways to allocate space for the string: 1. Declare an array, e.g., Char str[SIZEOFSTRING]; This declares str as an array with SIZEOFSTRING Chars. In most cases, you can treat an array of Chars the same way you treat Char *. 2. Declare a pointer, e.g., Char * str; str = MemPtrNew(SIZEOFSTRING); The first line declares str as a pointer to Char, but does not allocate any space for the string. The second line allocates space for SIZEOFSTRING Chars and assigns its address to str. Look at the docs for DmStrCopy and you'll see that its third parameter (srcP in the docs) is defined as Char *, a pointer to Char. DmStrCopy copies the sequence of Chars that start at the address passed in, and copies Chars from that address until it encounters the terminating /0. __________________________________________________ Do You Yahoo!? NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1 -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
