how convert large HEX string to binary

I have a string with 14 characters . This is a hex represantation of 7bytes. I want to convert it to binary.

int32_t Hex2Bin( uint8_t * pHexString, uint8_t * pBinArray )
{
int o = ;
int i = ; while ( pHexString[ i ] != 0x00 )
{
switch ( pHexString[ i ] )
{
case '':
pBinArray[ o ] = 0x00;
break;
case '':
pBinArray[ o ] = 0x10;
break;
case '':
pBinArray[ o ] = 0x20;
break;
case '':
pBinArray[ o ] = 0x30;
break;
case '':
pBinArray[ o ] = 0x40;
break;
case '':
pBinArray[ o ] = 0x50;
break;
case '':
pBinArray[ o ] = 0x60;
break;
case '':
pBinArray[ o ] = 0x70;
break;
case '':
pBinArray[ o ] = 0x80;
break;
case '':
pBinArray[ o ] = 0x90;
break;
case 'A':
case 'a':
pBinArray[ o ] = 0xa0;
break;
case 'B':
case 'b':
pBinArray[ o ] = 0xb0;
break;
case 'C':
case 'c':
pBinArray[ o ] = 0xc0;
break;
case 'D':
case 'd':
pBinArray[ o ] = 0xd0;
break;
case 'E':
case 'e':
pBinArray[ o ] = 0xe0;
break;
case 'F':
case 'f':
pBinArray[ o ] = 0xf0;
break;
default:
return -;
} if ( pHexString[ i + ] == 0x00 )
return -; switch ( pHexString[ i + ] )
{
case '':
pBinArray[ o ] |= 0x00;
break;
case '':
pBinArray[ o ] |= 0x01;
break;
case '':
pBinArray[ o ] |= 0x02;
break;
case '':
pBinArray[ o ] |= 0x03;
break;
case '':
pBinArray[ o ] |= 0x04;
break;
case '':
pBinArray[ o ] |= 0x05;
break;
case '':
pBinArray[ o ] |= 0x06;
break;
case '':
pBinArray[ o ] |= 0x07;
break;
case '':
pBinArray[ o ] |= 0x08;
break;
case '':
pBinArray[ o ] |= 0x09;
break;
case 'A':
case 'a':
pBinArray[ o ] |= 0x0a;
break;
case 'B':
case 'b':
pBinArray[ o ] |= 0x0b;
break;
case 'C':
case 'c':
pBinArray[ o ] |= 0x0c;
break;
case 'D':
case 'd':
pBinArray[ o ] |= 0x0d;
break;
case 'E':
case 'e':
pBinArray[ o ] |= 0x0e;
break;
case 'F':
case 'f':
pBinArray[ o ] |= 0x0f;
break;
default:
return -;
} i += ;
o++;
} return o;
}

how convert large HEX string to binary array ?的更多相关文章

  1. How to convert a byte to its binary string representation

    How to convert a byte to its binary string representation For example, the bits in a byte B are 1000 ...

  2. c++ hex string array 转换 串口常用

    c++ hex string array 转换 效果如下 tset string is follow 0x50 55 0x35 00 10 203040506073031323334ff format ...

  3. Convert string to binary and binary to string in C#

    String to binary method: public static string StringToBinary(string data) { StringBuilder sb = new S ...

  4. Java – How to convert String to Char Array

    Java – How to convert String to Char ArrayIn Java, you can use String.toCharArray() to convert a Str ...

  5. how to convert a number to a number array in javascript without convert number to a string

    how to convert a number to a number array in javascript without convert number to a string 如何在不将数字转换 ...

  6. itoa : Convert integer to string

      Quote from:  http://www.cplusplus.com/reference/cstdlib/itoa/   function   Required header : <s ...

  7. Swift3 - String 字符串、Array 数组、Dictionary 字典的使用

    Swift相关知识,本随笔为 字符串.数组.字典的简单使用,有理解.使用错误的地方望能指正. ///************************************************** ...

  8. How to: Convert Between Various String Types

      This topic demonstrates how to convert various Visual C++ string types into other strings. The str ...

  9. Matlab一个错误引发的血案:??? Error using ==> str2num Requires string or character array input.

    Matlab总遇到一些神奇的问题,让人摸不着头脑.昨天编写程序的时候遇到一个让我十分火大的问题,也是自己的matlab基础不好吧. 先描述一下问题,再GUI界面有个listbox,Tag属性是’lis ...

随机推荐

  1. ftp 服务

    ftp 上传下载 yum install ftp -y ftp:192.168.1.1 上传 put file1 下载 get file2 直接方式 ftp get test.tar.gz 文件 ft ...

  2. tf.Session()和tf.InteractiveSession()的区别

    官方tutorial是这么说的: The only difference with a regular Session is that an InteractiveSession installs i ...

  3. 【ARTS】01_06_左耳听风-20181217~1223

    ARTS: Algrothm: leetcode算法题目 Review: 阅读并且点评一篇英文技术文章 Tip/Techni: 学习一个技术技巧 Share: 分享一篇有观点和思考的技术文章 Algo ...

  4. C/C++杂记:深入理解数据成员指针、函数成员指针

    1. 数据成员指针 对于普通指针变量来说,其值是它所指向的地址,0表示空指针. 而对于数据成员指针变量来说,其值是数据成员所在地址相对于对象起始地址的偏移值,空指针用-1表示.例: 代码示例: str ...

  5. PHP中的__clone()

    1 <?php 2 class Account { 3 public $balance; 4 5 public function __construct($balance) { 6 $this- ...

  6. Java与PHPweb开发比较

    参考:https://blog.csdn.net/loophome/article/details/83413878

  7. C++ code:低级编程

    1 C编程 所谓低级编程,是相对于面向对象或基于对象的抽象层次更高的高级编程而言,就是: (1)不用C++STL的资源库,尽量减少内在的创建.调用.分配等的开销: (2)对程序管辖的内存进行直接操作访 ...

  8. **CI中自动类加载的用法总结

    总结: 哪一个类中用到某一个类,就在构造函数中加载这个类,比如m_attach,C_Feed类中有用到,那么就在构造函数中加载 控制器: class C_Feed extends CI_Control ...

  9. Java编程的逻辑 (6) - 如何从乱码中恢复 (上)?

    ​本系列文章经补充和完善,已修订整理成书<Java编程的逻辑>,由机械工业出版社华章分社出版,于2018年1月上市热销,读者好评如潮!各大网店和书店有售,欢迎购买,京东自营链接:http: ...

  10. 【LOJ】#2117. 「HNOI2015」实验比较

    题解 把所有=的点连起来,一个图合法肯定它是一个有向树森林 我们新建一个点,把这个点和其他所有树的树根连起来 定义\(dp[u][j]\)表示第u个点长度为j的序列的方案数 转移方法是 \(dp[u] ...