万能打印 万能比较

unsigned char aiot_strcmp( unsigned char *pst , unsigned char *str , unsigned char len)
{

     if((len == 0)||(pst == NULL)||(str == NULL))
	{
		return FALSE;
	}
		
	while( len-- )
	{
		if(*str++ != *pst++ )

		return FALSE;
	}
	return TRUE;
}
/*完成string->byte 失败比如前者非偶数返回0  成功返回byte长度*/
static char stringTobyte(const char* strings,unsigned char* bytes)
{
    char len = strlen(strings);
    char i = 0,j=0,lowbits=0,highbits=0;
    if(len%2)    return 0;
    for (i = 0; i < len; i+=2)
    {
            highbits = strToInt(strings[i]);
            lowbits  = strToInt(strings[i+1]);
            bytes[j++] = highbits << 4|lowbits;
    }
    return len/2;
}

猜你喜欢

转载自blog.csdn.net/weixin_42381351/article/details/85157848