>I am trying to add information to MemoPad from a PQA.  note and note2 parse
>fine and I can add them to MemoPad as one long string.  The problem occurs
>when I do a StrCat.  Line 1 works fine but line 2 crashes the Palm.  I get
>Memory manager has written to Memory data structures.  However, in the
>MemoPad, the memo was written correctly.   note and note2 are CharPtr.
>Any light to this problem would be welcome.
>
>1 StrCat(note,"\n");
>2 StrCat(note2,"\n");
>

NOT ACCEPTABLE:

CharPtr note;

StrCat(note,"blah blah"); // Fails because memory is only allocated for 
one pointer, not for multiple bytes

ACCEPTABLE:

Char note[128];

StrCat(note,"blah blah");

PREFERABLE UNDER SOME CIRCUMSTANCES:

CharPtr note;

note=MemPtrNew(128L);
StrCat(note,"blah blah");
// and after finishing with note
MemPtrFree(note);


Steve Patt
President, Stevens Creek Software
  http://www.stevenscreek.com/palm
  Best PQA ("ePQA"), PalmSource 99
  Best Application ("PizzaScan"), Palm Developer's Conference 1998
  First printing software for the Palm - September, 1997


-- 
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