Return to previous page Return to menu Go to next page

To access files in the
subdirectory, you must follow the steps below.
 Read directory information
↓
Current directory setting
↓
Open file
↓
Access to files
↓
Close file 

This procedure is illustrated by two examples.

[Example] Accessing files in a directory other than the root directory

Shows an example program for accessing the files in the subdirectory. Suppose that the file you want to access is in the directory specified by dir_fid in the current directory.

 #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);



Return to previous page Return to menu Go to next page