Bytes2HexStr与hexStr2Bytes
来源:互联网 发布:php 开源网盘系统 编辑:程序博客网 时间:2024/06/18 06:51
/* Byte值转换为bytes字符串 * @param src:Byte指针 srcLen:src长度 des:转换得到的bytes字符串 **/ static void Bytes2HexStr(BYTE *src,int srcLen,BYTE *des){BYTE *res;int i=0;res = des;while(srcLen>0){sprintf((char*)(res+i*2),"%02x",*(src+i));i++;srcLen--;}}/** * bytes字符串转换为Byte值 * @param String src Byte字符串,每个Byte之间没有分隔符 * @return byte[] */ static BYTE* hexStr2Bytes(string src){char *strEnd;int m=0;int len = src.length()/2;BYTE* ret = new BYTE[len];for(int i =0;i<len;i++){m = i*2;string subs = src.substr(m,2);ret[i] = strtol(subs.c_str(),&strEnd,16);}return ret;}
阅读全文
0 0
- Bytes2HexStr与hexStr2Bytes
- 与
- 与
- “” 与 “”
- ##与#
- >> 与 > >
- :与::
- &与&&
- && 与 &
- [[与((
- >>与>>>
- *与++
- *与++
- ++与++
- ->与 .
- :与::
- & | 与&& ||
- &&与&
- java 获取当前类的所有父类
- 【0018】navicat导出sql语句
- OpenSSL 静态、共享编译,解决ms\do_ms报错
- 【vmware 服务器安装】虚拟机centos6.5安装步骤
- 对json数组进行排序和filter过滤
- Bytes2HexStr与hexStr2Bytes
- 用Javascript获取页面元素的位置
- 416. Partition Equal Subset Sum
- 不要修改dtsi,修改自己板子的dts,通过 &label 语句修改子文件里已经存在的节点
- Contiki操作系统移植STM32F103基于Keil编程软件
- C#版本和.NET版本以及VS版本的对应关系
- sphinx中文索引实现中文检索
- F1V3.0-2 平台2.X优点继承及问题解决
- vs2008设置lib和h文件路径