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. 无锁并发框架Disruptor学习入门

    刚刚听说disruptor,大概理一下,只为方便自己理解,文末是一些自己认为比较好的博文,如果有需要的同学可以参考. 本文目标:快速了解Disruptor是什么,主要概念,怎么用 1.Disrupto ...

  2. 第一篇:初始Golang

    Golang简介 编程语言已经非常多,偏性能敏感的编译型语言有 C.C++.Java.C#.Delphi和Objective-C 等,偏快速业务开发的动态解析型语言有PHP.Python.Perl.R ...

  3. TensorBoard 简介及使用流程【转】

    转自:https://blog.csdn.net/gsww404/article/details/78605784 仅供学习参考,转载地址:http://blog.csdn.net/mzpmzk/ar ...

  4. .NET 的 WCF 和 WebService 有什么区别?(转载)

    [0]问题: WCF与 Web Service的区别是什么? 和ASP.NET Web Service有什么关系? WCF与ASP.NET Web Service的区别是什么? 这是很多.NET开发人 ...

  5. Gitlab & Github

    windwos上Git的使用 软件下载地址:https://github.com/git-for-windows/git/releases/download/v2.15.1.windows.2/Git ...

  6. VS2010上连接SQLite数据库

    VS2010连接SQLite数据库 Visual studio 2010及以上版本,连接SQLite数据库 1.在Sqlite开发站点下载SQLite的.exe安装包 Ctrl+F搜索这条语句:Thi ...

  7. dede列表页调用

    {dede:list pagesize ='16'} <li class="item pull-left"> <a class="item-wrap&q ...

  8. java 把被检查的异常转换为不检查的异常

    一.当我们不知道该怎么处理这个异常,但是也不想把它"吞"了,或者打印一些无用的信息,可以使用异常链的思路解决.可以直接报"被检查的异常"包装进RuntimeEx ...

  9. docker:定制node.js的版本

    本想用alpine,但如果想使用node.js 6.3.1版本的软件, 总会搞不定glibc和libstdc++报一个无法识别版本信息的错误. 搞了一天,算了.使用debian:stretch-sli ...

  10. hive1.2.1安装步骤(在hadoop2.6.4集群上)

    hive1.2.1在hadoop2.6.4集群上的安装 hive只需在一个节点上安装即可,这里再hadoop1上安装 1.上传hive安装包到/usr/local/目录下 2.解压 tar -zxvf ...