本文整理汇总了C++中CIniParser::GetVarRawString方法的典型用法代码示例。如果您正苦于以下问题:C++ CIniParser::GetVarRawString方法的具体用法?C++ CIniParser::GetVarRawString怎么用?C++ CIniParser::GetVarRawString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIniParser
的用法示例。
在下文中一共展示了CIniParser::GetVarRawString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadBurstMessage
/*BURST=<command number>, <burst message>, <update period>, <maximum update period>*/
int PublisherConf::LoadBurstMessage(CIniParser& parser /*[in]*/, const hart7::hostapp::MAC& mac, int burstMessageID, hart7::hostapp::BurstMessage& burstMessage/*[in/out]*/)
{
char szLogVarString[256] = "";
LOG_INFO_APP( "[LoadPublishers]: loading burst message...");
if (!parser.GetVarRawString(NULL, "BURST", szLogVarString, sizeof(szLogVarString), burstMessageID))
return -1;
LOG_INFO_APP( "[LoadPublishers]: BURST[" << mac << "]=" << szLogVarString);
unsigned int cmdNo, burstMsg;
char szSubdevMAC[32] = "", exData[2];
int rv = sscanf( szLogVarString, "%u, %u, %lf, %lf, %s, %1s "
, &cmdNo
, &burstMsg
, &(burstMessage.updatePeriod)
, &(burstMessage.maxUpdatePeriod)
, szSubdevMAC
, exData
);
if(rv != 4 && rv != 5)
{
LOG_ERROR_APP("[LoadPublishers]: read " << rv << " items from buffer instead of 4 or 5");
return -1;
}
if (rv == 4)
{
hart7::hostapp::MAC emptyMAC;
burstMessage.subDeviceMAC = emptyMAC;
}
else
{
try
{
hart7::hostapp::MAC subdevMAC(szSubdevMAC);
burstMessage.subDeviceMAC = subdevMAC;
}
catch (...)
{
return -1;
}
}
char burstNo[10]="";
snprintf(burstNo,sizeof(burstNo),"%d",burstMessageID);
char szVarName[] = "BURST_SET_PUBLISH_PERIOD_";
strcat(szVarName, burstNo);
if (parser.GetVarRawString(NULL, szVarName, szLogVarString, sizeof(szLogVarString)))
{
std::stringstream(szLogVarString) >> burstMessage.updatePeriod;
LOG_INFO_APP("[LoadPublishers]: BURST_SET_PUBLISH_PERIOD loaded: updatePeriod=" << burstMessage.updatePeriod << " overrides base update period.");
}