char array/strcat() problem
i'm trying to break a char array up and process it and then return the processed string. the unpack function will be at the bottom, if you don't know what its doing just by looking at the code.
char buffer, flag;
int rc = recv(engine::esock.sock, buffer, sizeof(buffer), 0);
if ((rc != -1) && (rc != 0))
unsigned int value = unpack(buffer, buffer);
itoa(value, flag, 10);
char instruction[rc - 2], rebuff[rc + 3];
int i = 0;
int c = rc - 2;
while (i < c)
instruction[i] = buffer[i + 2];
case(0): // creation accept
engine::sockRcvErr = 0;
what the code is suppose to do is take a string turn the first two bytes of the string into a 5 digit number and make that a string. then take the rest of the string and make that into another string and then add the two of them into one string and return that string.
unsigned int unpack(char byteA, char byteB)
return ((static_cast<unsigned int>(byteA) << 8) | byteB);
i know i have a switch statement with only one case. this is because there will be thousands of cases later.