probleme char *msgRF custom string from function

Hi i'm not a pro in c/c++. For one of my 433mhz RF project I'm sending signal with the virtualwire librairy.

in every exemple this is the important part of the code:

char *msgRF;
...
msgRF = "G9";
...
vw_send((uint8_t *)msgRF, strlen(msgRF));

So this way is working good, but now i wish to make a function that send a signal but with different code, like "A9", "B9", "C9"...

So i tought to code something like that:

char *msgRF;

...

void loop(){
   sendSignal("A");
}

...

void sendSignal(String ID){   //I tried char ID and still don't work
   msgRF = ID+"9";
   ...
   vw_send((uint8_t *)msgRF, strlen(msgRF));
}

But i'm having errors. I do not really understant the *... I can code msgRF = "string"; but can't do msgRF = ID+"string"... How can I program this, I need to keep the char *msgRF

those are the king of error I got

BlindAutomation_get_state.ino:53:14: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]

BlindAutomation_get_state.ino:53:9: error: cannot convert 'StringSumHelper' to 'char*' in assignment

Like I said i'm more a java/vb programmer so c/c++ are a bit different.

Thank you

Maybe something like this:

void sendSignal(String ID)
  {   
   String msgRF = ID + "9";

   vw_send((uint8_t *) msgRF.c_str(), msgRF.length ());
  }

Or

void sendSignal(char *ID)
{
   char msg[8];

   strcpy(msg, ID);
   strcat(msg, "9");

   vw_send((uint8_t *) msg, strlen(msg));
}

with no need to use the dreaded String class.

Thank you both, I actually only tried the way of PaulS. it work. I just want to know why char msg[8], why the 8 ?

I just want to know why char msg[8], why the 8 ?

It's enough to hold all the characters that you said the message should be, plus the terminating NULL, without being too big. If you change the message, you need to increase or decrease that value, to provide enough space.

ok. out of those 8 how many do I need for the terminating null (or how many are for my message on those 8) ? So I can know how much increase for a bigger message.

Thank for the help

how many do I need for the terminating null

One.

If ID is "G", that's one byte. The "9" is one byte. So, technically, the array size could be 3. But, I never like odd numbers for array sizes. So, the minimum, in my opinion only, should be 4.