hey im getting an array bounds overflow....
any help would be greatly appreciated.Code:if (command == 1)
{
char outMessage[1] = "1";
nBytes = send(mySocket, outMessage, sizeof(outMessage), 0);
printf("Message Sent : %s\n", outMessage);
}
Printable View
hey im getting an array bounds overflow....
any help would be greatly appreciated.Code:if (command == 1)
{
char outMessage[1] = "1";
nBytes = send(mySocket, outMessage, sizeof(outMessage), 0);
printf("Message Sent : %s\n", outMessage);
}
>>char outMessage[1] = "1";
The array size must be at least 2 to account for the null character implicit in string literals.
Thanks man i completely forgot about that. Damn short term memory. I cant try it now but im sure thats the problem. :D
So just say
char outMessage[] = "1";
and let the compiler do the counting for you