- void LoadSvrConf()
- {
- CMyIni ini;
- if(ini.Load("./conf/server.conf"))
- {
- svr_log.FormatEx(1 ,"Load File Error %s" , strerror(errno));
- exit(-1);
- }
- memset(&svr_conf , 0 , sizeof(svr_conf));
- svr_conf.iDaemon = ini.GetIniInt("SERVER_SYS_CONFIG" , "USE_DAEMON" , 0);
- strcpy(svr_conf.sLocalIP , ini.GetIniStr("SERVER_SYS_CONFIG","BIND_ADDRESS_UDP", "192.168.67.46").c_str());
- svr_conf.usLocalPort=(uint16_t)ini.GetIniInt("SERVER_SYS_CONFIG","LISTEN_PORT_UDP",8000);
- strcpy(svr_conf.sDBIP ,ini.GetIniStr("SERVER_SYS_CONFIG" , "DB_SVR_IP" , "192.168.67.47").c_str());
- svr_log.FormatEx(1 ,"Daemon:%d " , svr_conf.iDaemon);
- svr_log.FormatEx(1 , "Local IP:%s:%u DB IP:%s", svr_conf.sLocalIP ,svr_conf.usLocalPort , svr_conf.sDBIP);
- }
读取配置文件
最新推荐文章于 2021-02-25 22:15:08 发布