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. Linux 网络操作

    Linux 基础网路操作  ifconfig eth0 down # 禁用网卡 ifconfig eth0 up # 启用网卡 ifup eth0: # 启用网卡 mii-tool em1 # 查看网 ...

  2. 第7月第11天 AVAsset

    1. An AVAsset defines the collective properties of the tracks that comprise the asset. (You can acce ...

  3. git与代码托管工具

    1.git初识 git是一个版本管理工具,用来管理项目的不同的版本,记录下不同的提交记录,git还可以构建不同的分支,用来给不同的人来推送使用. 推荐的git教程:https://www.cnblog ...

  4. [Alg] 尺取法

    尺取法是在线性结构中进行搜寻满足某一条件的区间的方法. 该方法保存两个索引--首索引begin.尾索引end.判断 [begin, end] 区间是否满足条件. 移动 [begin, end] 区间的 ...

  5. TFS报表管理器无权限访问的配置

    刚接触TFS,有太多的功能不能知道怎么配置,今天想了解一下TFS的报表功能,当登录TFS后,点击项目中的“查看报表”

  6. eclipse导入导出工作空间配置

    首先,导出T1中的配置:打开T1,选择fileExport 在弹出框中选择General 下的preferencenext在export preferences 页面选择export all, 点Br ...

  7. springboot自定义SpringApplication启动类

    如果默认的SpringApplication不符合你的口味,你可以创建一个本地的实例并自定义它.例如,关闭banner你可以这样写: public static void main(String[] ...

  8. react-native 报错

    报错信息: java.lang.RuntimeException: Unable to load script from assets 'index.android.bundle'. Make sur ...

  9. PHP使用某个键值对二维数组排序

    $arr=[ array( 'name'=>'A', 'age'=>28 ), array( 'name'=>'B', 'age'=>14 ), array( 'name'=& ...

  10. docker 的简单操作

    一直说更博,但是一直在delay.... 最近一直用到docker,所以就总结一下吧! docker的介绍 Docker 是一个开源的应用容器引擎,基于 Go 语言 并遵从Apache2.0协议开源. ...