At 09:30 PM 10/23/2004, you wrote:
#define MySizeVari   34
#define myStr

Char* myStr = (Char*) MemPtrNew(MySizeVari);  // allocate a 13-byte pointer
//StrCopy(myStr, "Hello World!");       // use it
MemPtrFree(myStr);

why dosent this work

I have changed all kinds of stuff around read the api's 7 ways till sunday and i still cant make sense of it

I want to create a memrory space large enough to store 17 bytes of information that I am going to pull off the serial port. Look through it, process it to usable information ,use it to update a form and repeat the process about as many times as I can in once second untill I tell it to stop. "Its a realtime datalogger application"

What do you mean by "outside a function"? C and C++ require all code to be inside functions.


This should work, but for such a small allocation, you could also just write

Char myStr[MySizeVari];

and allocate it on the stack instead.  You then wouldn't need to free it later.


-- Ben Combee, Technical Lead, Developer Services, PalmSource, Inc. "Combee on Palm OS" weblog: http://palmos.combee.net/ Developer Fourm Archives: http://news.palmos.com/read/all_forums/



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

Reply via email to