how do i concatenate a an array.
This is the code.
char data [128];
char c, s, l;
char *cmd_array [128];
count = 0;
char * pch_W;
pch_W = strtok ( inbuf, " " );
while ( pch_W != NULL ) {
cmd_array_W [ count ] = pch_W;
pch_W = strtok ( NULL, " " );
count ++;
}
c = atoi ( cmd_array_W [ 1 ] );
s = atoi ( cmd_array_W [ 2 ] );
l = atoi ( cmd_array_W [ 3 ] );
strcpy(data, cmd_array[4]);
this piece if code works, but the problem is if data is more that 1 character.
basically, inbuf would be something like w 1 1 12 hello world --> this actually dont work
I slit inbuf by spaces and store them in respective variables. if data is 1 character, my programs works fine, but if its something like the above one its doesnt work.
how do i concatenate the char array from a certain position, or how do i split inbuf into 2 and store in data the 2nd half?