WEB开发网
开发学院手机开发Windows Mobile 开发 在Windows mobile 5.0下操作INI文件 阅读

在Windows mobile 5.0下操作INI文件

 2010-08-22 12:58:00 来源:WEB开发网   
核心提示:strCombine = pBuf;delete[] pBuf;int iIndex1, iIndex2, iIndex3,iIndex4, iIndexT;iIndex1 = strCombine.Find(CString(lpFolderName));if(iIndex1 == -1){iniFile.Close(

strCombine = pBuf;

delete[] pBuf;

int iIndex1, iIndex2, iIndex3,iIndex4, iIndexT;

iIndex1 = strCombine.Find(CString(lpFolderName));

if(iIndex1 == -1)

{

iniFile.Close();

return FALSE;

}

iIndex2 = strCombine.Find(CString(lpKey), iIndex1);

if(iIndex2 == -1)

{

iniFile.Close();

return FALSE;

}

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

if(iIndex3 == -1)

{

iniFile.Close();

return FALSE;

}

else

{

iIndex4 = strCombine.Find(L" ", iIndex3);

if(iIndex4 == -1)

{

iniFile.Close();

return FALSE;

}

strCombine.Delete(iIndex3+1, iIndex4- iIndex3-1);

strCombine.Insert(iIndex3+1, CString(lpValue));

LPTSTR lpCombine = strCombine.GetBuffer(0);

iniFile.SetLength(0);

iniFile.SeekToBegin();

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

iniFile.Close();

return TRUE;

}

iniFile.Close();

return FALSE;

}

4.获取section数量

int GetINISectionNum(LPCTSTR lpFileName)

{

CFile iniFile;

PBYTE pFileBuf;

CString szBuf;

DWORD dwLength;

int iIniNum=0;

if (lpFileName == NULL)

return 0;

if(!iniFile.Open(lpFileName, CFile::modeRead))

return 0;

dwLength = (DWORD)iniFile.GetLength();

if (dwLength == 0)

return 0;

pFileBuf = new BYTE[dwLength + 2];

if (pFileBuf == NULL)

return 0;

memset(pFileBuf, 0x0, dwLength + 2);

iniFile.Read((void *)pFileBuf, dwLength);

iniFile.Close();

if (pFileBuf[0] == 0xFF && pFileBuf[1] == 0xFE)

上一页  1 2 3 4 5 6  下一页

Tags:Windows mobile 操作

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