Chinaunix首页 | 论坛 | 博客
  • 博客访问: 174220
  • 博文数量: 96
  • 博客积分: 4060
  • 博客等级: 上校
  • 技术积分: 1040
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-12 13:13
文章分类

全部博文(96)

文章存档

2011年(3)

2010年(76)

2009年(17)

我的朋友

分类: 嵌入式

2010-08-18 12:17:38

int SmsDecode7bit(const unsigned char* pSrc, char* pDst, int nSrcLength)
{
        int nSrc;               
        int nDst;               
        int nByte;               
        unsigned char nLeft;

        nSrc = 0;
        nDst = 0;
       
        nByte = 0;
        nLeft = 0;

        while(nSrc         {
                *pDst = ((*pSrc << nByte) | nLeft) & 0x7f;
                nLeft = *pSrc >> (7-nByte);

                pDst++;
                nDst++;

                nByte++;

                if(nByte == 7)
                {
                        *pDst = nLeft;

                        pDst++;
                        nDst++;

                        nByte = 0;
                        nLeft = 0;
                }

                pSrc++;
                nSrc++;
        }

        *pDst = '\0';

        return nDst;
}
阅读(533) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~