Here is my code:
nodebug void sendLogPacketS(char *func, char *msg)
{
char * log;
memset(log, 0, strlen(func) + strlen(msg) + 1);
strcpy(log, func);
strcat(log, ": ");
strcat(log, msg);
sendUDPLogPacket(log, strlen(log));
}
It's supposed to take two strings, concatenate them together, then pass the new string and its length to a different function. I'm using Dynamic C 9.62, which doesn't have support for the malloc
function, so I'm using memset instead.
The problem is when I printf the value of log
before it's passed to sendUDPLogPacket
, it contains garbage DynamiCUniversal Rabbit BIOS Version 9.50\?^>j
. Anyone have any ideas why this isn't working?