#define MAX_DIR 10 / * Maximum number of directory information * /GfsDirTbl curdir; / * Current directory at this point * / GfsDirTbl dirtbl1, dirtbl2; / * Directory information management area * / GfsDirId dirid1 [MAX_DIR]; / * Directory information storage area * / GfsDirId dirid2 [MAX_DIR]; / * Directory information storage area * / Sint32 dir_fid1, dir_fid2; / * Contains the directory file identifier * / Sint32 fid1, fid2; / * Contains the identifier of the file to be accessed * / GfsHn gfs1, gfs2; / * File handle of the file to be accessed * /
/ * Read directory information of dir_fid1 of current directory * / GFS_DIRTBL_TYPE (&dirtbl1) = GFS_DIR_ID; GFS_DIRTBL_NDIR (&dirtbl1) = MAX_DIR; GFS_DIRTBL_DIRID(&dirtbl1) = dirid1; GFS_LoadDir(dir_gfs1, &dirtbl1);
/ * Read the directory information of dir_fid2 of the current directory * / GFS_DIRTBL_TYPE (&dirtbl2) = GFS_DIR_ID; GFS_DIRTBL_NDIR (&dirtbl2) = MAX_DIR; GFS_DIRTBL_DIRID(&dirtbl2) = dirid2; GFS_LoadDir(dir_gfs2, &dirtbl2);
/ * Open the file dir_fid1 and fid1 * / GFS_SetDir (&dirtbl1); gfs1 = GFS_Open(fid1);
/ * Open the file dir_fid2 and fid2 * / GFS_SetDir (&dirtbl2); gfs2 = GFS_Open(fid2); /* * File access here */ GFS_Close(gfs1); GFS_Close(gfs2);
[Example] / * Open the file specified by the file name * /
GfsHn OpenByName (Uint8 * fname)
{
Sint32 fid = GFS_NameToId (fname);
If (fid <0) {
Return NULL;
}
Return GFS_Open (fid);