作者 newbie [c] 2015-05-11 13:31 (点击下载) (原始帖子: newbie 在 2015-05-11 13:21 被修改)) (显示不同)

  1. char xxoo[202] = "1234567890abcdef1234......";
  2. struct ooxx = {int a; int b; byte c[100]};
  3.  
  4. how to initialize an ooxx object to
  5. {1,2,{0x34,0x56,0x78......}}
  6.  
  7. inline int char2int(char i) {
  8. if (i >= '0' && i <= '9')
  9. return i - '0';
  10. if (i >= 'a' && i <= 'f')
  11. return i - 'a' + 10;
  12. }
  13.  
  14. inline byte 2char2byte(char i, char j)
  15. return (char2int(i)<<4) + char2int(j);
  16.  
  17. ooxx x = {char2int(xxoo[0]),char2int(xxoo[1])
  18. {2char2byte(xxoo[2],xxoo[3]),2char2byte(xxoo[4],xxoo[5])......2char2byte(xxoo[200],xxoo[201])}
  19. }

提交下面的校正或者修改. (点击这里开始一个新的帖子)
姓名: 在 cookie 中记住我的名字

屏幕抓图:(jpeg 或 png)