user6688: I have two non constant char arrays. One is "buff" and other is "buffa". I get values in buffa via rf transmitter of other Arduino and I want to append those data to the data inside of buff. Then I will send all data to other Arduino. So I don't want to send two different char arrays. I want to send them all at once as just one array.
I TRIED SPRINTF BUT IT DOESNT WORK.
char buffa[144]; 
    char buff[1000];


void loop() {

  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;

  sprintf(buff,"<status>\n");    



    if (vw_get_message(buf, &buflen)) { // check to see if anything has been received
      int i;
      for (i = 0; i < buflen; i++) {
        buffa[i] = (char) buf[i];  // the received data is stored in buffer

      }
    }


  distance1 = getDistance(initPin1, echoPin1);
  sendData(3, distance1);

  sprintf(buff, "%s", buffa);




delay(5000);
 const char *msg0 = buff;


 vw_send((uint8_t *)msg0, strlen(msg0)); // Send control character 
 vw_wait_tx();

 Serial.print(msg0);

}


user6701: Assuming the data in buffa is a c-style string (i.e. null-terminated), replace
sprintf(buff, "%s", buffa);

with
strcat( buff, buffa );


6688: <p>I have two non constant char arrays. One is "buff" and other is "buffa". I get values in buffa via rf transmitter of other Arduino and I want to append those data to the data inside of buff. Then I will send all data to other Arduino. So I don't want to send two different char arrays. I want to send them all at once as just one array.</p>

<p>I TRIED SPRINTF BUT IT DOESNT WORK.</p>

<pre><code>char buffa[144]; 
    char buff[1000];


void loop() {

  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;

  sprintf(buff,"&lt;status&gt;\n");    



    if (vw_get_message(buf, &amp;buflen)) { // check to see if anything has been received
      int i;
      for (i = 0; i &lt; buflen; i++) {
        buffa[i] = (char) buf[i];  // the received data is stored in buffer

      }
    }


  distance1 = getDistance(initPin1, echoPin1);
  sendData(3, distance1);

  sprintf(buff, "%s", buffa);




delay(5000);
 const char *msg0 = buff;


 vw_send((uint8_t *)msg0, strlen(msg0)); // Send control character 
 vw_wait_tx();

 Serial.print(msg0);

}
</code></pre>
 6701: <p>Assuming the data in buffa is a c-style string (i.e. null-terminated), replace</p>

<pre><code>sprintf(buff, "%s", buffa);
</code></pre>

<p>with</p>

<pre><code>strcat( buff, buffa );
</code></pre>
