Symbian 读写 INI 配置文件的方法
2010-04-20 16:06:00 来源:WEB开发网#include
////////////////////////////////////////////////////
_LIT8(KCRLF, “ ”);
////////////////////////////////////////////////////
CFile *CFile::NewL(const TDesC &p_fileName)
{
CFile *self = CFile::NewLC(p_fileName);
CleanupStack::Pop(self);
return self;
}
CFile *CFile::NewLC(const TDesC &p_fileName)
{
CFile *self = new(ELeave) CFile(p_fileName);
CleanupStack::PushL(self);
return self;
}
CFile::CFile(const TDesC &p_fileName)
{
mFileName.Copy(p_fileName);
mFileSize = 0;
}
CFile::~CFile()
{
}
void CFile::ConstructL(TUint p_shareMode)
{
User::LeaveIfError(fs.Connect() );
TInt err = file.Open( fs, mFileName, p_shareMode);
if(err==KErrNotFound) // file does not exist ? create it
err=file.Create(fs, mFileName, p_shareMode);
file.Size(mFileSize);
}
TInt CFile::FileSize() const
{
return mFileSize;
}
TInt CFile::FPuts(const TDesC8 &aDes)
{
return file.Write(aDes);
}
TInt CFile::FGets(TDes8 &aDes) const
{
return file.Read(aDes);
}
TInt CFile::FSeek(TSeek aMode, TInt &aPos) const
{
return file.Seek(aMode, aPos);
}
TInt CFile::FSetSize(TInt aSize)
{
return file.SetSize(aSize);
}
void CFile::DostroyL()
{
file.Close();
fs.Close();
}
bool CFile::MakeCbmDir(const TDesC& aPath){
RFs fs;
User::LeaveIfError(fs.Connect() );
if( BaflUtils::FolderExists(fs,aPath) ){
更多精彩
赞助商链接