VC读取和写入配置文件
2014-03-13 10:33
330 查看
char CDstr[MAX_PATH];
TCHAR IniFilePath[MAX_PATH];
GetModuleFileName(NULL,IniFilePath,MAX_PATH);
m_strFileName = CString(IniFilePath);
m_strFileName = m_strFileName.Left(m_strFileName.ReverseFind('\\'));///得到初始化文件的全路径
m_strFileName += "\\Rulecfg.cfg";
iPcPort = GetPrivateProfileInt("PC_PARA","PC_PORT",1000,m_strFileName);
GetPrivateProfileString("PC_PARA","PC_IP","",CDstr,64,m_strFileName);
strPcIp = CDstr;
m_DspNum = GetPrivateProfileInt("DSP_PARA","DSP_NUM",1,m_strFileName);
iDspDelayTime = GetPrivateProfileInt("DSP_PARA","DSP_DELAY_TIME",5,m_strFileName);
GetPrivateProfileString("DSP_PARA","IMAGE_POSITION","",CDstr,64,m_strFileName);
strAppPosition = CDstr;
//////////////////////////////////////////////////////////////////////////////写入配置文件///////////////////////////////////////////////////////////////////////
strSecName.Format("DSP%d_RULE_PARA",m_DspIndex+1);
strKeyPrefix.Format("DSP%d_",m_DspIndex+1);
//////////////////////DSP信息
str.Format("%d",m_tdp2[m_DspIndex].l32Width);
WritePrivateProfileString(strSecName,strKeyPrefix+"IMAGE_WIDTH",str,m_strFileName);
str.Format("%d",m_tdp2[m_DspIndex].l32Height);
WritePrivateProfileString(strSecName,strKeyPrefix+"IMAGE_HEIGHT",str,m_strFileName);
str.Format("%d",m_tdp2[m_DspIndex].l32RoiNum);
WritePrivateProfileString(strSecName,strKeyPrefix+"LANE_NUM",str,m_strFileName);
TCHAR IniFilePath[MAX_PATH];
GetModuleFileName(NULL,IniFilePath,MAX_PATH);
m_strFileName = CString(IniFilePath);
m_strFileName = m_strFileName.Left(m_strFileName.ReverseFind('\\'));///得到初始化文件的全路径
m_strFileName += "\\Rulecfg.cfg";
iPcPort = GetPrivateProfileInt("PC_PARA","PC_PORT",1000,m_strFileName);
GetPrivateProfileString("PC_PARA","PC_IP","",CDstr,64,m_strFileName);
strPcIp = CDstr;
m_DspNum = GetPrivateProfileInt("DSP_PARA","DSP_NUM",1,m_strFileName);
iDspDelayTime = GetPrivateProfileInt("DSP_PARA","DSP_DELAY_TIME",5,m_strFileName);
GetPrivateProfileString("DSP_PARA","IMAGE_POSITION","",CDstr,64,m_strFileName);
strAppPosition = CDstr;
//////////////////////////////////////////////////////////////////////////////写入配置文件///////////////////////////////////////////////////////////////////////
strSecName.Format("DSP%d_RULE_PARA",m_DspIndex+1);
strKeyPrefix.Format("DSP%d_",m_DspIndex+1);
//////////////////////DSP信息
str.Format("%d",m_tdp2[m_DspIndex].l32Width);
WritePrivateProfileString(strSecName,strKeyPrefix+"IMAGE_WIDTH",str,m_strFileName);
str.Format("%d",m_tdp2[m_DspIndex].l32Height);
WritePrivateProfileString(strSecName,strKeyPrefix+"IMAGE_HEIGHT",str,m_strFileName);
str.Format("%d",m_tdp2[m_DspIndex].l32RoiNum);
WritePrivateProfileString(strSecName,strKeyPrefix+"LANE_NUM",str,m_strFileName);
相关文章推荐
- VC配置文件读取和写入
- 向INI配置文件写入\读取数据
- VC读取写入 ini文件内容的方法函数详解
- vc中读取配置文件
- VC++中对文件的写入和读取
- 读取(写入)配置文件
- Python Configparser模块读取、写入配置文件
- vc中读取配置文件的方法
- [转]VC++中对文件的写入和读取
- Python 读取写入配置文件 —— ConfigParser
- VC读取大文件之创建文件映射及文件写入效率测试
- MFC中配置文件的写入及读取操作
- Python 读取写入配置文件 —— ConfigParser
- 用VC读取和分析格式化文本配置文件
- Java配置文件Properties的读取、写入与更新操作
- PropertiesHelper——配置文件读取和写入工具类
- properties配置文件的读取和写入
- vc2008: 控制台程序将数据写入MySql(数据库信息从配置文件读取)
- vc中读取配置文件的方法
- 读取和写入手机配置文件代码