Read directory information ↓ Current directory setting ↓ Open file ↓ Access to files ↓ Close file
This procedure is illustrated by two examples.
#define MAX_DIR 10 / * Maximum number of directory information * /GfsDirTbl dirtbl; / * Directory information storage area * / GfsDirId dirid [MAX_DIR]; / * Directory information storage area * / Sint32 dir_fid; / * Contains directory file identifier * / Sint32 fid; / * Contains the identifier of the file to be accessed * / GfsHn gfs; / * File handle of the file to access * /
GFS_DIRTBL_TYPE (&dirtbl) = GFS_DIR_ID; GFS_DIRTBL_NDIR (&dirtbl) = MAX_DIR; GFS_DIRTBL_DIRID(&dirtbl) = dirid; GFS_LoadDir (dir_fid, & dirtbl); / * Read directory information * /
GFS_SetDir (& dirtbl); / * Set current directory * /
/ * Set the identifier of the file that accesses fid * / gfs = GFS_Open(fid); /* * File access here */ GFS_Close(gfs);