user47576: Is there any other function to add strings into buffer and updating values as well.
This is the problem I am coping with while using strcat()

char temp[2] = "A";
char temp_end[2] = "a";
char buf_adc[20]="alok";
char buf_hum[20]="lok";
char buf_temp[20]="vjf";
char buf[100];
void setup() {
Serial.begin(115200);

}

void loop() {
  strcat(buf,buf_adc);
strcat(buf,temp);
strcat(buf,buf_hum);
strcat(buf,temp);
strcat(buf,buf_temp);
strcat(buf,temp_end);

Serial.println(buf);

}


user4143: strcat always concatenates to the end of the string. Instead, for your first strcat you should really be using strcpy, which copies one string over the top of the other - that is, it places it at the start of the string, effectively starting a new string.
However, unless you really need the data in a string for some specific reason, you don't need to build a string up - just print each part to serial separately with its own Serial.print function.

47576: <p>Is there any other function to add strings into buffer and updating values as well.</p>

<p>This is the problem I am coping with while using strcat()</p>

<p><a href="https://i.stack.imgur.com/nV2SK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nV2SK.png" alt="enter image description here"></a></p>

<pre><code>char temp[2] = "A";
char temp_end[2] = "a";
char buf_adc[20]="alok";
char buf_hum[20]="lok";
char buf_temp[20]="vjf";
char buf[100];
void setup() {
Serial.begin(115200);

}

void loop() {
  strcat(buf,buf_adc);
strcat(buf,temp);
strcat(buf,buf_hum);
strcat(buf,temp);
strcat(buf,buf_temp);
strcat(buf,temp_end);

Serial.println(buf);

}
</code></pre>
 4143: <p><code>strcat</code> always concatenates to the end of the string. Instead, for your first <code>strcat</code> you should really be using <code>strcpy</code>, which copies one string over the top of the other - that is, it places it at the <em>start</em> of the string, effectively starting a new string.</p>

<p>However, unless you <em>really</em> need the data in a string for some specific reason, you don't need to build a string up - just print each part to serial separately with its own <code>Serial.print</code> function.</p>
