WEB开发网
开发学院手机开发Symbian 开发 Symbian OS应用开发 文件和目录 阅读

Symbian OS应用开发 文件和目录

 2010-05-31 19:48:00 来源:WEB开发网   
核心提示:_LIT(KStringSize,"%S%S");User::LeaveIfError(iSessionRFs.Connect());path = PathInfo::PhoneMemoryRootPath();path.Append(PathInfo::PicturesPath()); //pic

_LIT(KStringSize,"%S%S");

User::LeaveIfError(iSessionRFs.Connect());

path = PathInfo::PhoneMemoryRootPath();

path.Append(PathInfo::PicturesPath()); //picture的文件夹

User::LeaveIfError(iSessionRFs.GetDir(path, //读出文件夹下文件信息

KEntryAttMaskSupported,

ESortByName,

dirList));

TInt j = dirList->Count(); //文件数目

for (TInt i = 0;i< p>

{ //添加你的操作

filename.Format(KStringSize,&path,&(*dirList)[0].iName);

CAknInformationNote* informationNote;

informationNote = new (ELeave) CAknInformationNote;

informationNote->ExecuteLD(filename);

}

delete dirList;

------------------------------------

通过上面的例程可以看出枚举文件夹中的文件主要是通过GetDir()函数来完成的,这个函数的介绍如下:

--------------------------------------------------------------------------------

GetDir()

TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey, CDir*& anEntryList) const;

Description

Gets a filtered list of a directory's contents. The bitmask determines which file and directory entry types should be listed. The sort key determines the order in which they are listed.

Notes:

If sorting by UID (ESortByUid is OR'ed with the entry sort key), then UID information will be included in the listing whether or not KEntryAttAllowUid is specified in anEntryAttMask.

The function sets anEntryList to NULL, then allocates memory for it before appending entries to the list. Therefore, anEntryList should have no memory allocated to it before this function is called, otherwise this memory will become orphaned.

The caller of this function is responsible for deleting anEntryList after the function has returned.

上一页  1 2 3 4 5  下一页

Tags:Symbian OS 应用开发

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