WEB开发网
开发学院手机开发Windows Mobile 开发 Windows Moblie 利用EVC读写INI XML配置文件 阅读

Windows Moblie 利用EVC读写INI XML配置文件

 2010-08-22 12:59:00 来源:WEB开发网   
核心提示:{strCombine.Insert(iIndexT, strEntry + L"=" + strValue + L"");LPTSTR lpCombine = strCombine.GetBuffer(0);IniFile.SetLength(0);IniFile.SeekTo

{

strCombine.Insert(iIndexT, strEntry + L"=" + strValue + L" ");

LPTSTR lpCombine = strCombine.GetBuffer(0);

IniFile.SetLength(0);

IniFile.SeekToBegin();

IniFile.Write(lpCombine, strCombine.GetLength() * 2);

IniFile.Close();

return TRUE;

}

else

{

iIndex3 = strCombine.Find(L" ", iIndex2 + 1);

if(iIndex3 == -1)

{

IniFile.Close();

return FALSE;

}

iIndexT = iIndex2 + 1 + strEntry.GetLength();

strCombine.Delete(iIndexT, iIndex3 - iIndexT);

strCombine.Insert(iIndexT, strValue);

LPTSTR lpCombine = strCombine.GetBuffer(0);

IniFile.SetLength(0);

IniFile.SeekToBegin();

IniFile.Write(lpCombine, strCombine.GetLength() * 2);

IniFile.Close();

return TRUE;

}

}

CATCH(CFileException, e)

{

}

END_CATCH

IniFile.Close();

return FALSE;

}

写整型

BOOL CProfile::WriteProfileInt(const CString strSection, const CString strEntry, const int iValue, const CString strIniPath)

{

wchar_t cBuff[MAX_LEN];

CString strValue("");

_itow(iValue, cBuff, 10);

strValue.Format(_T("%s"), cBuff);

return CProfile::WriteProfileString(strSection, strEntry, strValue, strIniPath);

}

2.读配置文件

Code

CString CProfile::GetProfileString(const CString strSection, const CString strEntry, const CString strDefault, const CString strIniPath)

{

if(strSection == L"" || strEntry == L"" || strIniPath == L"")

{

return strDefault;

}

CFile IniFile;

CString strCombine;

TRY

{

上一页  1 2 3 4  下一页

Tags:Windows Moblie 利用

编辑录入:coldstar [复制链接] [打 印]
赞助商链接