Symbian 读写 INI 配置文件的方法
2010-04-20 16:06:00 来源:WEB开发网(m_pIniElements->At(i)->_Key.Compare( (TDesC8&)p_Key ) ==0 ))
{
m_pIniElements->At(i)->_Value.Copy(p_Value);
b_KeyFind = 1;
break;
}
}
if(0 == b_KeyFind)
{
TInt b_secFind = 0;
for(int i=0; i
{
if( (m_pIniElements->At(i)->_Section.Compare( (TDesC8&)p_Section ) ==0) &&
(m_pIniElements->At(i)->_Key.Compare( _L8(“##”)) != 0) )
{
m_pIniElements->InsertL(i+1, element);
b_secFind = 1;
break;
}
}
if(b_secFind != 1) //??????????section
m_pIniElements->AppendL(element);
}
//??????
/*for(int i=0; i
{
TBuf8<512> dd;
dd.Format(_L8(“%S %S %S ”), &(m_pIniElements->At(i)->_Section), &(m_pIniElements->At(i)->_Key), &(m_pIniElements->At(i)->_Value));
CFile::LogToFile(_L(“c:\stock\debugini.txt”), dd);
}
*/
//???ڴ??е?ini??д???ļ?
ConstructL(EFileRead | EFileWrite);
TInt pos;
FSeek(ESeekStart,pos);
FSetSize(0);
WriteIni();
CloseIni(); //?ر??ļ????
return 1;
}
void CIniFile::WriteIni()
{
if(m_pIniElements->Count()>0)
{
TBuf8<40> szCurSection(_L8(“”));
HBufC8 *strm = HBufC8::NewL(255);
strm->Des().Zero();
szCurSection.Copy(m_pIniElements->At(0)->_Section);
if(szCurSection.Compare( _L8(“###”)) != 0)//?ļ???ͷ??ע?ͺͿ???
{
更多精彩
赞助商链接