/*****************************************************************
* DESCRIPTION:
* 将MAC字符串转为数组存储
* INPUTS:
* pMacStr - 指向MAC字符串
* OUTPUTS:
* pMacArr - 指向MAC数组
* RETURNS:
* 6 - 成功,数组长度
* 其他 - 失败
* NOTES:
* none
*****************************************************************/
int WCY_MacStrToArr
(
IN const char *pMacStr,
OUT char *pMacArr
)
{
unsigned int m[6] = {0};
/* 恢复sscanf的使用 */
#undef sscanf
#define sscanf sscanf
if (sscanf(pMacStr, "%02X-%02X-%02X-%02X-%02X-%02X", &m[0], &m[1], &m[2], &m[3], &m[4], &m[5]) != 6) {
return 0;
}
pMacArr[0] = m[0];
pMacArr[1] = m[1];
pMacArr[2] = m[2];
pMacArr[3] = m[3];
pMacArr[4] = m[4];
pMacArr[5] = m[5];
return 6;
}