Currently I'm working on an assignment and using C++ for the first time. I'm trying to append certain "message types" to the beginning of strings so when sent to the server/client it will deal with the strings depending on the message type. I was wondering if I would be able to put any two-digit integer into an element of the message buffer.... see below.
I've left a section of the code below:
char messageBuffer[32];
messageBuffer[0] = '10'; << I get an overflow here
messageBuffer[1] = '0';
for (int i = 2; i < (userName.size() + 2); i++)
{
messageBuffer[i] = userName[(i - 2)];
}
Thanks =)