[SOLVED]How to 'replicate' an array of hex values?
I have a set of 4 fixed bytes that i put in an array:
Code:
char fixed[] = "\xcd\xf1\x12\xbf";
Then I want to fill another newarray[1028] with the values of the array above.
(ie 257 X fixed[] inside newarray[1028]) and get something like:
Code:
char newarray[1028] = "\xcd\xf1\x12\xbf\xcd\xf1\x12\xbf\xcd\xf1\x12\xbf.........";
I tried with an ugly loop but I doesn't seem to work:
Code:
int i, j = 0;
char fixed[] = "\xcd\xf1\x12\xbf";
char newarray[1028];
for(i=0;i<1028;i++) {
if(j > 3)
j = 0;
newarray[i] = fixed[j];
j++;
}
Any idea how I can 'replicate' an array n times in another array?