本文整理汇总了C++中CData::BcdToAsc方法的典型用法代码示例。如果您正苦于以下问题:C++ CData::BcdToAsc方法的具体用法?C++ CData::BcdToAsc怎么用?C++ CData::BcdToAsc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CData
的用法示例。
在下文中一共展示了CData::BcdToAsc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SMT_GetLastInvoiceNo
/*=================================================================
* Function ID : SMT_GetLastInvoiceNo
* Input : char* cpath, char* str
* Output : void
* Author : DengJun
* Date : Apr 2005
* Return : void
* Description :
* Notice :
* :
*=================================================================*/
bool CMyLog::SMT_GetLastInvoiceNo(char* sID, int *nInvoiceNo )
{
char sValue[20];
char sKeyName[20];
int nValue=0;
CData cData;
FileBase mfile;
memset(sValue,0,sizeof sValue);
memset(sKeyName,0,sizeof sKeyName);
cData.BcdToAsc((byte*)sID,4,(byte*)sKeyName);
g_CriticalSectionLock.Lock();
if( g_WriteFileLock )
{
g_CriticalSectionLock.Unlock();
return false;
}
g_WriteFileLock=true;
GetPrivateProfileString(sKeyName, "NO", "-1",sValue,sizeof(sValue),g_sCommRec);
if( atoi(sValue)==-1 )
{
memset(sValue,0,sizeof sValue);
sprintf(sValue,"[%s]",sKeyName);
mfile.AddLineToFile(g_sCommRec,sValue,strlen(sValue));
memset(sValue,0,sizeof sValue);
strcpy(sValue,"NO=1");
mfile.AddLineToFile(g_sCommRec,sValue,strlen(sValue));
*nInvoiceNo=0;
}
else
{
*nInvoiceNo=atol(sValue);
if( *nInvoiceNo>=65535 ) nValue=-1;
else nValue=*nInvoiceNo;
sprintf(sValue,"%ld",++nValue);
WritePrivateProfileString(sKeyName, "NO",sValue,g_sCommRec);
}
g_WriteFileLock=false;
g_CriticalSectionLock.Unlock();
return true;
}
示例2: ShowDeviceInfo
/*=================================================================
* Function ID : ShowDeviceInfo
* Input : void
* Output : void
* Author :
* Date : 2006 4
* Return :
* Description :
* Notice : 将收到的终端档案信息显示于界面并写日志
*
*=================================================================*/
void CSmartCommunicationDlg::ShowDeviceInfo( )
{
CData cData;
char msg[256];
char buf[40];
char lpbuf[2048];
int i=0;
int n=0;
memset(msg,0x00,sizeof msg);
memset(buf,0x00,sizeof buf);
if( !g_LTcpsmart.empty() )
{
sprintf(msg,"共有 %ld TCP/IP线程链路",g_LTcpsmart.size());
AddString(msg);
n=1;
list<CSocketSmart>::iterator SmtSmart;
for( SmtSmart=g_LTcpsmart.begin();SmtSmart!=g_LTcpsmart.end();SmtSmart++)
{
memset(lpbuf,0x00,sizeof lpbuf);
memset(buf,0x00,sizeof buf);
sprintf(msg,">>>>>第%03ld个TCP/IP通讯服务ID号 %s ",n++,(char*)cData.BcdToAsc((BYTE*)SmtSmart->m_IDNo,4,(BYTE*)buf));
strcpy(lpbuf,msg);
memset(buf,0x00,sizeof buf);
sprintf(msg,"服务注册号 %s ",(char*)cData.BcdToAsc((BYTE*)SmtSmart->m_regno,4,(BYTE*)buf));
strcat(lpbuf,msg);
sprintf(msg,"服务机器号 %ld ",SmtSmart->m_MacNum);
strcat(lpbuf,msg);
sprintf(msg,"服务端口数% ld",SmtSmart->m_nPortTotal);
strcat(lpbuf,msg);
memset(buf,0x00,sizeof buf);
sprintf(msg,"服务机型号 %s",(char*)cData.BcdToAsc((BYTE*)SmtSmart->m_MacCode,2,(BYTE*)buf));
strcat(lpbuf,msg);
sprintf(msg,"服务IP地址 %s",SmtSmart->m_IpPar.cIPAddress);
strcat(lpbuf,msg);
sprintf(msg,"服务端口号 %ld",SmtSmart->m_IpPar.nPortNo);
strcat(lpbuf,msg);
AddString(lpbuf);
WriteLog(lpbuf);
for( i=0; i<SmtSmart->m_nTotalPos; i++)
{
memset(buf,0x00,sizeof buf);
memset(lpbuf,0x00,sizeof lpbuf);
sprintf(msg,"第%02ld子设备:机器号 %03ld",i+1,SmtSmart->m_SmartPos[i].ucMacNo);
strcat(lpbuf,msg);
memset(buf,0x00,sizeof buf);
sprintf(msg," ID号 %s",(char*)cData.BcdToAsc(SmtSmart->m_SmartPos[i].ucpIDNo,4,(BYTE*)buf));
strcat(lpbuf,msg);
memset(buf,0x00,sizeof buf);
sprintf(msg," 注册号 %s",(char*)cData.BcdToAsc(SmtSmart->m_SmartPos[i].ucRegNo,4,(BYTE*)buf));
strcat(lpbuf,msg);
memset(buf,0x00,sizeof buf);
sprintf(msg," 机型 %s",(char*)cData.BcdToAsc(SmtSmart->m_SmartPos[i].ucpMachineCode,2,(BYTE*)buf));
strcat(lpbuf,msg);
sprintf(msg," 端口号 %ld",SmtSmart->m_SmartPos[i].nPort);
strcat(lpbuf,msg);
AddString(lpbuf);
WriteLog(lpbuf);
}
AddString(" ");
}
}
return ;
}