I have this code which works :
String ErrorMsg;
.......
if(!UploadPacketError)
{
ErrorMsg="OK";
}
else
{
ErrorMsg="NOK";
}
String creates a dynamically allocated array which I want to avoid. I would prefer something like :
unsigned char ErrorMsg[5];
......
if(!UploadPacketError)
{
strcpy(ErroMsg,"OK",3); // +1 for the Null Termination ?
}
else
{
strcpy(ErroMsg,"NOK",4); // +1 for the Null Termination ?
}
i.e. is there a way to dynamically assign a value to a fixed size character array ?
Cheers Thomas