In strcpy(string1,string2);
the contents of string2 is assigned to string1.So if you want to put contents of character array tempStr
in `str,you need to try this :
strcpy(str,lr_eval_string("{tempStr}"));
.This should do the trick.You can see a related use of the statement over here.
You are declaring HUGE ARRAY ( char str[1024]
) OR the size of c_response
could be more than str
and this may be the reason why you are getting that error . Instead of that you can dynamically allocate memory by using malloc
,which is a good practice and is considered safe.
(By looking at the code everything looks just fine so, again,unless you show the whole code its quite difficult to say).
Declaring very large arrays in C is very bad practice.Just take a look at this :How many chars can be in a char array?