[EMAIL PROTECTED] wrote:
> > static void foo()
> > {
> >    Char badboy[100];
> >    StrCopy(badboy, "I cause program counter modifications\0");
> > }
> 
> Looks fine to me, assuming that there are 100 bytes available on the stack at
> the time you call foo().  That "\0" at the end of your string looks silly, but
> it shouldn't cause any problems.

Hmmm... my experience is that if I didn't put a '\0' at the end, StrCopy
would cause a few "memory allocation" error messages to pop up. My
initial guess was that during runtime, StrCopy(a, b) couldn't find the
proper end of b and kept reading past my string until it finds a '\0'
somewhere down the (memory) lane. Is that how StrCopy() works? I've sent
in the agreement for the release of the PalmOS sourcecode but do not
have a reply yet. (It has been about 5 weeks now, not that I'm
complaining.)

> I'll bet that creating a new project, slapping in the above function, and
> calling it won't turn up any problems.  I'm guessing the source of your crash 
> is
> elsewhere.
Well, I've tried using StrCopy() (like above) in the Memopad app
tutorial, and it bombed POSE. Is it some CW6 setting that I've neglected
to set/disable/modify ?

> > Can anyone tell me what I did wrong? Do I have to do badboy =
> > MemPtrNew(100); everytime I want to use StrCopy(), or StrPrintF() and
> > such?
> 
> No, you don't have to call MemPtrNew.  Doing a StrCopy to a stack-based array 
> of
> chars should be OK, as long as the source is smaller than the destination.
OK, another slap on my hand for not keeping awake during CS501
(Compilers and Operating Systems) lectures, I beg to ask this : "when is
an array not stack-based?"

Thanks Keith!


-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to