设为首页 加入收藏

TOP

VC资源文件版本解析类: (2) 源文件 (三)
2014-11-23 21:34:49 来源: 作者: 【 】 浏览:379
Tags:源文件 版本 解析
>>16,sep,ulLow&0x0000FFFF);
558 return buf;
559}
560
561wstring CRCVersion::VerToStrW(ULONGLONG ullVer,wchar_t wsep/**//*=L'.'*/)
562{
563 ULONG ulHigh = ullVer >> 32;
564 ULONG ulLow = ullVer & 0x00000000FFFFFFFF;
565 wchar_t buf[32];
566 swprintf(buf,L"%d%c%d%c%d%c%d",ulHigh>>16,wsep,ulHigh&0x0000FFFF,wsep,ulLow>>16,wsep,ulLow&0x0000FFFF);
567 return buf;
568}
569
570ULONGLONG CRCVersion::StrToVerA(const string& strVer,char sep /**//*='.'*/)
571{
572 long a = 0, b = 0, c = 0, d = 0;
573 ULONGLONG ullVal = 0;
574
575 size_t pos, pos1, pos2;
576 pos = strVer.find(sep);
577 if (pos != string::npos)
578 a = atol(strVer.substr(0,pos).c_str());
579 pos1 = strVer.find(sep,pos+1);
580 if (pos1 != string::npos)
581 b = atol(strVer.substr(pos+1,pos1-pos-1).c_str());
582 pos2 = strVer.find(sep,pos1+1);
583 if (pos2 != string::npos)
584 c = atol(strVer.substr(pos1+1,pos2-pos1-1).c_str());
585 d = atol(strVer.substr(pos2+1).c_str());
586 ullVal = (((ULONGLONG)((a << 16) + b)) << 32) + (c << 16) + d;
587
588 return ullVal;
589}
590
591ULONGLONG CRCVersion::StrToVerW(const wstring& wstrVer,wchar_t wsep/**//*=L'.'*/)
592{
593 long a = 0, b = 0, c = 0, d = 0;
594 ULONGLONG ullVal = 0;
595
596 size_t pos, pos1, pos2;
597 pos = wstrVer.find(wsep);
598 if (pos != string::npos)
599 a = _wtol(wstrVer.substr(0,pos).c_str());
600 pos1 = wstrVer.find(wsep,pos+1);
601 if (pos1 != string::npos)
602 b = _wtol(wstrVer.substr(pos+1,pos1-pos-1).c_str());
603 pos2 = wstrVer.find(wsep,pos1+1);
604 if (pos2 != string::npos)
605 c = _wtol(wstrVer.substr(pos1+1,pos2-pos1-1).c_str());
606 d = _wtol(wstrVer.substr(pos2+1).c_str());
607 ullVal = (((ULONGLONG)((a << 16) + b)) << 32) + (c << 16) + d;
608
609 return ullVal;
610}

作者“天道酬勤”

首页 上一页 1 2 3 4 5 6 下一页 尾页 3/6/6
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇VC中Unicode字符串的处理 下一篇VC++ MFC的ActiveX窗口处理相关知..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: