将字符数组转换为字节的最佳方法是什么,反之亦然?
解决方案:
void CharToByte(char* chars, byte* bytes, unsigned int count){
for(unsigned int i = 0; i < count; i++)
bytes[i] = (byte)chars[i];
}
void ByteToChar(byte* bytes, char* chars, unsigned int count){
for(unsigned int i = 0; i < count; i++)
chars[i] = (char)bytes[i];
}