If "newtext" is a char* (as I suspect it is), you
are just allocating as much memory as the size of
the pointer, not as much memory as the size of
the string that it is pointing to.  You probably
want to use "StrLen(newtext)+1".  The +1 is important
because StrLen() will give you the length of the
string, but will not account for the NUL character
which terminates the string.

-- 
-Richard M. Hartman
[EMAIL PROTECTED]

186,000 mi./sec ... not just a good idea, it's the LAW!


> -----Original Message-----
> From: Stuart Norton [mailto:[EMAIL PROTECTED]]
> 
> I may have found it though. I'm assigning memory for a 
> temporary CharPtr.
> Here's the line:
> CharPtr disptext=MemPtrNew(sizeof(newtext));
> I'm then pointing the field to disptext, copying newtext to 
> disptext using
> StrCopy, and updating the field. I'm hoping this procedure 
> would work for
> writing to the display but it doesn't. Firstly, is using 
> "sizeof(newtext)"
> acutally assigning enough memory, and secondly why doesn't it 
> work? I read
> somewhere that you don't need to use a text handle for read 
> only fields, but
> can just use FldSetTextPtr() as I am doing.
> 

Reply via email to