strcat() function

Hi, I’m new to using Dynamic C and Rabbit technology, but as a kind of ‘hello world’ type of application I’ve been trying to make a function to translate a char* plain-text alphanumerical message into a string of morse code (using dots, dashes, slashes, and spaces). I’ve already implemented the functions which translate a single character into morse code, and which interpret a morse-code string and make one of the module’s LEDs flash the morse code.

However, attempting to iterate through each character in the char* to translate into morse code and then concatenate it to a longer string, I’ve come across a problem with Dynamic C’s strcat() function.

Important bit :wink:
strcat() doesn’t remove the \0 from the end of the first string before appending the second, so the null-terminated string essentially remains the same. What’s the easiest way to correct this problem?

Thanks in advance for any suggestions.


Works OK for me. Are you sure you’ve got the arguments in the right order?

I just tried this with DC10.50:

   strcpy(buf, "Hello ");
   strcat(buf, "world");
   printf("buf = %s
", buf);

I get:
buf = Hello world

Perhaps it has been updated? When I try the same thing, the string is simply "Hello ". Perhaps I’ll try updating my version of Dynamic C.