Wm_strcpy help

i have this

ascii *rscript;
wm_strcpy(rscript,"AT+RSCRIPT=");

if i put a breakpoint after wm_strcpy the stack is not available and i get Cannot access memory at address 0x522b5441. Does anybody have an idea what is happening?

it has to be like this :slight_smile:

ascii rscript[150];
wm_strcpy(rscript,"AT+RSCRIPT=");

please, repost the code, I can’t read it still. :stuck_out_tongue:

i don’t understand what do you mean :question:

The “code” section, it’s empty (or at least I can’t read it… :S)

this was the problem

ascii *rscript;
wm_strcpy(rscript,“AT+RSCRIPT=”);

and this is the solution

ascii rscript[150];
wm_strcpy(rscript,“AT+RSCRIPT=”);

and for me the code section is not empty :slight_smile:

I’ve also been having problems with “ascii *x” and “ascii x[y]”. It usually works with “ascii x[y]”, but i’m still wondering why…

You have a basic hole in your understanding of the ‘C’ programming language!

You need to go back to your ‘C’ textbook, and review the difference between pointers and arrays

ascii *x defineds a pointer - you need to separately allocate some space for it to point to, and then you need to set the value of the pointer;

ascii x[y]
defines an array of y items, each of which is of type ascii; the name ‘x’ alone is a synonym for the address of the first element of the array

See: c-faq.com/aryptr/index.html

and, specifically: c-faq.com/aryptr/aryptrequiv.html