I'm not an expert, but I see a couple of things that seem incorrect to me.

I believe you're writing into unallocated memory.  First, for you var, you
can allocate memory either via MemHandleNew or initialize your var as:

char str[100];  //where 100 would be replaced with the max_length you want

Your initialization was creating a char array of fixed length and you were
overwriting with StrCat.

Also, StrCat's args are (destination, src) and it returns destination also.
So in your first call to it you were telling the OS to add "." to getTim()
and place it in getTim() which isn't a variable.  I think what you want is:

char str[100];
StrCat(str,getTim());
StrCat(str, ".");
StrCat(str,getMin());

Hope this helps.

Craig

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of maria
jönsson
Sent: Monday, October 22, 2001 10:06 AM
To: Palm Developer Forum
Subject: Why cant I use StrCat


Hi all!

I have 2 functions: getTim and getMin, they return a char*.
I want to concatenate these to strings with a "." i the middle.
But when I do this I get the error message:

CTR(unknown version)just wrote to memory location 0x00030E83,
which is in the storage heap. In order to protect the integrity of the
user's data, such direct access is not allowed. Instead, applications
should use special Palm OS functions for this purpose.

It seems that StrCat is not available, does any of you know what I shold use
instead??

this is my code:

char* str= " ";
        str= StrCat(getTim(), ".");
        str= StrCat(str,getMin());

//write to the field:
UInt16 Index = FrmGetObjectIndex(form, fldMon);
        FieldType *ptr = (FieldType *) FrmGetObjectPtr(form, Index);
        FldSetTextPtr(ptr, str);
        FldDrawField(ptr);

_________________________________________________________________
Hämta MSN Explorer kostnadsfritt på http://explorer.msn.se


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


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