better way than strcat!?

Hello I must have a lot of strings assembled in one string.
right new I do it with strcat
But it takes too much capacity, all works in until I get too many strcat functions.

This example works but is there another way to do it!

char data_fil[0xff];

void setup() {

void loop() {

kim jessen


sprintf( data_fil, "%s%s%s\n", "string1", "string2", "string3" );

Alternatively, use your strcat in a loop.

Are they actual strings or array strings?

yeah, +1 for sprintf. It can be used for string arrays too.

As a general rule, sprintf() is overkill for a single data type use like this. The sprintf() version uses 3366 bytes versus 1954 for the strcat() version. Because sprintf() is like a Swiss Army knife, it can do a lot of things of which concatenating strings is but a small subset. So, unless you are using multiple aspects of sprintf(), strcat() will yield smaller code size.

What does data_fil contain after loop() is called the first time? What does it contain after loop() is called the second, third, fourth, ... time?

Might be helpful if you gave us the real requirement. How many strings, what size are they? Where do they come from, and crucially, why do you need them concatenated into one big string?

many thanks for all your input.
I will try it when I get home.
I must use it to gather various information along to a "get" function for my ether net client

kim jessen