I just played around with these lines of code. Actually there weren't any bugs, I just had to add a "*" to the STRING(*) mySTR.

I modified the code in several ways, but don't understand the outcome in all cases. So I'd appreciate your advice again.

As this might become quit complicated, I numbered the different alternatives:

1) First of all, I changed the str_cpy to "str_cpy(mySTR, testCharStruct.charArray[2]);" and expected mySTR to become "s". But that did not happen, mySTR became "st". Obviously all chars beginning with number 2 to the last one were copied in mySTR. But why?

2) After that, I tried to figure out wether a change of the struct will result in only a single value (the "s"). So I changed the code to:

Code:

struct test {
char charArray;
};
struct test testCharStruct[5];
...
testCharStruct[0].charArray='t';
...
str_cpy(MyStr, testCharStruct[2].charArray);



But again the result was "st". Again, why? How do I copy just one value out of the struct?

3) In the next step, I wanted to implement a string into the struct:

Code:

STRING* stringTest;

struct test{
STRING* stringTest[5];
};
...



Here, "str_cpy(MyStr, testStruct.stringTest); indeed only gives one value back, the "t". Obviously strings won't be "summed up". But why are there differences between char arrays and string arrays in structs, when both are - in a way - the same??

4) According to these results, a str_cpy(myStr, testStruct.stringTest[2]); should finally lead to the single "s". But nah.. this line leads to a crash of SED.

5) By changing the struct to an "struct array" like in (2) SED crashed immediately.


And now, I just figured out that all versions, even the unmodified I copied from you, result in a crash after the debug mode run for about 4 minutes. This is caused by a "Error E1515: Invalid arguments". According to the manual, this means that "a function is called with a wrong number of types of arguments".

This very confusing and the manual isn't very helpfull either :-(
I just wanted to add, I'm very happy to have such excellent help here online. Without you I really wouldn't know what to do.
So thank you very, very much!