本文整理汇总了C++中CConfig::GetConfigFile方法的典型用法代码示例。如果您正苦于以下问题:C++ CConfig::GetConfigFile方法的具体用法?C++ CConfig::GetConfigFile怎么用?C++ CConfig::GetConfigFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConfig
的用法示例。
在下文中一共展示了CConfig::GetConfigFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
static int Init(int argc, char *argv[])
{
CConfig *pConfig = &g_config;
char sConfFilePath[255]={0};
if (argc != 2)
{
printf("Usage: %s Config_file\n", argv[0]); return -1;
}
if (strlen(argv[1]) >= sizeof(sConfFilePath))
{
printf("Config file path too long!\n"); return -1;
}
strncpy(sConfFilePath, argv[1], strlen(argv[1]));
pConfig->GetConfigFile(sConfFilePath,
"LOGFILEPATH", CONFIG_STRING, &(pConfig->sLogFilePath), "/tmp/dshmproxy",
"LOG_SIZE", CONFIG_INT, &(pConfig->iMaxLogSize), 0,
"LOG_NUM", CONFIG_INT, &(pConfig->iMaxLogNum), 0,
"LOG_LV_SHM_KEY", CONFIG_INT, &(pConfig->iLogLvShmKey), 0,
"PULL_IP", CONFIG_STRING, &(pConfig->sPullIp), "",
"PULL_PORT", CONFIG_INT, &(pConfig->nPullPort), 0,
"PUB_IP", CONFIG_STRING, &(pConfig->sPubIp), "",
"PUB_PORT", CONFIG_INT, &(pConfig->nPubPort), 0,
"RESP_IP", CONFIG_STRING, &(pConfig->sRespIp), "",
"RESP_PORT", CONFIG_INT, &(pConfig->nRespPort), 0,
"MASTER_IP", CONFIG_STRING, &(pConfig->sMasterIp), "",
"MASTER_PORT", CONFIG_INT, &(pConfig->nMasterPort), 0,
"DB_IP", CONFIG_STRING, &(pConfig->sDbIp), "",
"DB_USER_NAME", CONFIG_STRING, &(pConfig->sDbUserName), "",
"DB_PASS", CONFIG_STRING, &(pConfig->sDbPass), "",
"DB_NAME", CONFIG_STRING, &(pConfig->sDbName), "",
"DB_PORT", CONFIG_INT, &(pConfig->iDbPort), 0,
"DB_MAX_RECORD", CONFIG_INT, &(pConfig->iDbMaxRecord), 10000,
"LOOP_SLEEP", CONFIG_INT, &(pConfig->iLoopInterMsec), 20,
NULL);
return 0;
}