谁有将短消息PDU数据转换成ASCII的代码? 手机受到一条英文短信,如何将UD中数据转成ASCii? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我用 bcb5 写的7位字符串编码、解码的函数:hellohello -> E8329BFD4697D9EC37 互转没有问题。AnsiString bit7encode(AnsiString input){ int i, j, len, cur; AnsiString text, hex, ret; char chm, chn; len = input.Length(); text = input; i = 1; j = 0; while (i <= len) { chm = text[i]; if (i < len) { chn = text[i + 1]; cur = (chm >> j ) | ((chn << (7-j)) & 0xff); } else cur = (chm >> j ) & 0x7f; hex = IntToHex(cur, 2); ret = ret + hex; i++; j = (j + 1) % 7; if (j == 0) i++; } return ret;}AnsiString bit7decode(AnsiString input){ AnsiString ret, text; char hex, hey; unsigned char chm, chn; int i, j, len; int debug; AnsiString tp; len = input.Length(); text = input; j = 0; for (i = 1; i <= len; i+=2) { chm = StrToInt("0x" + text.SubString(i, 2)); if (i > 1) chn = StrToInt("0x" + text.SubString(i - 2, 2)); if (j == 0) { hex = chm & 0x7f; if (i > 1) { hey = chn >> 1; ret += hey; } } else { hex = ((chm << j) | (chn >> (8 - j))) & 0x7f; } j = (j + 1) % 7; ret += hex ; } return ret;} 网络达人进 如何把一个目录拖动到treectrl中并显示节点的变化(蓝色)? 求助关于双屏显示问题 ctreectrl与clistctrl实现资源管理器, (求助)用VS2008编译器建的新项目,建的是对话框,没选"系统菜单",怎么补充上去?? 如何将RTF流数据写入RichEdit? 大虾们给小弟推荐些vc 数据库方面的书 把独立的应用程序移植到dll中! 一个笨问题 我的作业 求助:一个关于在VC++6.0中调用SQLSERVER2000存储过程的问题(百分求助) 郁闷!!!
AnsiString bit7encode(AnsiString input)
{
int i, j, len, cur;
AnsiString text, hex, ret;
char chm, chn; len = input.Length();
text = input; i = 1; j = 0;
while (i <= len)
{
chm = text[i]; if (i < len)
{
chn = text[i + 1];
cur = (chm >> j ) | ((chn << (7-j)) & 0xff);
}
else
cur = (chm >> j ) & 0x7f; hex = IntToHex(cur, 2); ret = ret + hex;
i++;
j = (j + 1) % 7;
if (j == 0)
i++;
}
return ret;
}AnsiString bit7decode(AnsiString input)
{
AnsiString ret, text;
char hex, hey;
unsigned char chm, chn;
int i, j, len;
int debug; AnsiString tp; len = input.Length();
text = input;
j = 0;
for (i = 1; i <= len; i+=2)
{
chm = StrToInt("0x" + text.SubString(i, 2)); if (i > 1)
chn = StrToInt("0x" + text.SubString(i - 2, 2)); if (j == 0)
{
hex = chm & 0x7f;
if (i > 1)
{
hey = chn >> 1;
ret += hey;
}
}
else
{
hex = ((chm << j) | (chn >> (8 - j))) & 0x7f;
}
j = (j + 1) % 7; ret += hex ;
}
return ret;
}