首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

给位高手了

2012-10-16 
求助给位高手了是这样我从web中读取到了一个字符串是 mac144&mac2f3&mac3ed&mac434,我想把44 f3 ed 34

求助给位高手了
是这样我从web中读取到了一个字符串是 mac1=44&mac2=f3&mac3=ed&mac4=34,我想把44 f3 ed 34按照16进制存在一个数组中 弄好长时间了 谢谢各位了 ~~~在线等 好急 用c语言

[解决办法]

C/C++ code
#include <string.h>#include <stdio.h>int main(int argc, char* argv[]){    char str[] = "mac1=44&mac2=f3&mac3=ed&mac4=34";    unsigned char hexs[4];    sscanf(str, "mac1=%02x&mac2=%02x&mac3=%02x&mac4=%02x", &hexs[0], &hexs[1], &hexs[2], &hexs[3]);    printf("%02x %02x %02x %02x\n", hexs[0], hexs[1], hexs[2], hexs[3]);    return 0;}
[解决办法]
探讨
C/C++ code

#include <string.h>
#include <stdio.h>

int main(int argc, char* argv[])
{
char str[] = "mac1=44&amp;mac2=f3&amp;mac3=ed&amp;mac4=34";
unsigned char hexs[4];
sscanf(st……

热点排行