这段代码什么作用? 有关arp

来源:百度知道 编辑:UC知道 时间:2024/06/12 19:40:27
来于:http://tech.cuit.edu.cn/forum/thread-103-1-6.html

void StrToMac(char *str, unsigned char *mac)
{
char *str1;
int i;
int low,high;
char temp;

for ( i=0; i<6; i++ )
{
str1 = str + 1;
switch ( *str )
{
case 'a':
high = 10;
break;
case 'b':
high = 11;
break;
case 'c':
high = 12;
break;
case 'd':
high = 13;
break;
case 'e':
high = 14;
break;
case 'f':
high = 15;
break;
default:
temp = *str;
high = atoi(&temp);
}

switch ( * str1 )
{
case 'a':
low = 10;
break;
case 'b':
low = 11;
break;
case 'c':

如果是在VC6.0环境,添加一个头文件就行了。
#include <stdlib.h>

没用

应该是将字符串方式表示的mac地址转换为以太网帧结构中能够接受的表示方式.
但是你的代码有问题,应该不能实现这种转换.