Concatenating array OR char

Hi All,

I just wasted my whole afternoon on a very simple problem, and eventhough I googled a lot, I couldn't find out what I should do.
Basically, I have this 5 data that I want to concatenate into a single one. Sounds very easy, isn't it?
Each of these data are basically a set of 4 integers. for example somethign like this: {100,255,0,6}.

All I want to do is to combine all these data into a single one, so that I can use one foor loop, read the data and do something.

But it seems impossible! Does anyone have any suggestions?

For example, I started with a very simplified case of binary values, I put them into a char like this:

char data1[]="0001";
char data2[]="0001";
char data3[]="0001";
char data4[]="0001";
char data5[]="0001";
char data_all;
data1.concat(data2); //gives an error
data_all=data1+data2; //gives an error

I get errors like this:
data_all does not name a type

Any suggestion?
Thanks

You are confusing Strings with arrays of char. For arrays of char, such as you have here, you need to make sure that data_all has room for everybody by declaring it data_all[32] (or whatever size you need). Then you use strcat() to build up your string.

KeithRB:
You are confusing Strings with arrays of char. For arrays of char, such as you have here, you need to make sure that data_all has room for everybody by declaring it data_all[32] (or whatever size you need). Then you use strcat() to build up your string.

I have tried that, but I still get an error. The code is:

char data1[]="0000000001";
char data2[]="0000000001";
char data3[]="0000000001";
char data4[]="0000000001";
char data5[]="0000000001";
char data_all[50]="";
strcat(data_all,data1);

This is the error message:
simple_2:46: error: expected constructor, destructor, or type conversion before '(' token

strcat(data_all,data1);

^

exit status 1
expected constructor, destructor, or type conversion before '(' token

I'm doing something silly, I know. I just don't know what it is.

Show all your code. Is this inside setup() or loop()? strcat() is a runtime only function.

KeithRB:
Show all your code. Is this inside setup() or loop()? strcat() is a runtime only function.

OK, so that was the problem. Thanks.