Bad news:  MemPtrNew is a function and so you can't call it outside of a 
segment of code.

Good news:  Once you call it, you can access the memory pointer anywhere 
inside your code until you free it using MemPtrFree.

What you may want to do is if you're in need of a large (or semi-large or 
any size really) amount of memory, create a global string pointer (char*) 
and allocate memory using MemPtrNew in AppStart.  You can then use it 
anywhere in your code.  Free it using MemPtrFree in AppStop.  This of course 
means it won't be valid between program calls.

Hope this helps,
Tim Kostka
Palm OS Enthusiast


"chad downey" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> #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"
> 



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

Reply via email to