mfsHFindFirst


Format: s32 mfsHFindFirst(const u8* path, MfsFfblk *ffblk, u16 attr)

Arguments:

*path	Search target pathname
*ffblk	MfsFfblk structure
attr	Attribute of file to be found

Return value:Error

Function:Searches a directory

Description:This function begins a search for the file specified by path.

path is a character string that contains the drive, directory, and file name (including extension) of the search target. Wildcard characters (* or ?) can be included in the file name. If a matching file is found, its information is stored in the MfsFfblk structure. The MfsFfblk structure consists of the following members.

typedef struct st_ffblk {
	MfsFileOperations* fileOpe;
	MfsStat stat;
	u8 name[MFS_FILE_NAME_SIZE + MFS_FILE_TYPE_SIZE];
	u8 path[MFS_FILE_NAME_SIZE + MFS_FILE_TYPE_SIZE];
	MfsDirList dirList;
} MfsFfblk;

File information is entered in stat among these members. Also, the matched file name is entered in name. The other members are used by the library.

The attribute of the file to be found is specified for attr. The values that can be specified are the values shown below or a value obtained by taking the logical OR of these values.

MFS_FILE_ATTR_DIRECTORY	0x8000	Directory
MFS_FILE_ATTR_FILE	0x4000	File
MFS_FILE_ATTR_FORBID_W	0x2000	Write protected
MFS_FILE_ATTR_FORBID_R	0x1000	Read protected
MFS_FILE_ATTR_HIDDEN	0x0800	Hidden file
MFS_FILE_ATTR_ENCODE	0x0400	Encoded file
MFS_FILE_ATTR_COPYLIMIT	0x0200	Copy limited

If a matching file is found, MFS_ERR_NO is returned. If no file is found, MFS_ERR_SEARCHEND is returned.

Main errors:

MFS_ERR_NO		Normal termination
MFS_ERR_NOTFOUND	Drive not found
MFS_ERR_DEVICE		Device error
			An error occurred in an internally called Leo function. Since a Leo function error is stored in the variable mfsError, check this variable to perform processing.
MFS_ERR_PROTECT		Write protected
			The volume attribute is write protected, or the medium is volume protected.