FSDirEntry


Definitions

#include <nitro/fs.h>

/* file-and-directory entry information structure for FS_ReadDir() */

typedef struct
{
    union {
        FSFileID  file_id;            /* valid if !is_directory */

        FSDirPos  dir_id;             /* valid if is_directory */
          } ;

    u32   is_directory;               /* directory ? 1 : 0 */

    u32   name_len;                   /* strlen(name) */

    char  name[FS_FILE_NAME_MAX + 1]; /* string with '\0' */

} FSDirEntry;
    

Description

The FS_ReadDir function uses this structure to obtain directory entry information.

Cautions

Future extensions may change the sizes in this type. Avoid programming that is dependent on the sizes in the current implementation.

Arguments

file_id A valid file ID for use when is_directory is 0.
The FS_OpenFileFast function uses this value.
dir_id A valid directory list position for use when is_directory is 1.
The FS_SeekDir function uses this value.
is_directory The type of information that the FS_ReadDir function stores in this structure.
Value 0 for file information, 1 for directory information.
name_len The number of characters that are in a file or directory name stored in name.
The number of characters does not include the terminating NUL.
name A character string (a file or directory name)
The FS_ReadDir function will append a terminating "\0" to this character string.

See Also

FSDirPos, FS_OpenFileFast, FS_ReadDir, FS_SeekDir, FS_FILE_NAME_MAX

Revision History

11/02/2004 Corrected the structure definition to match the header file.
05/14/2004 Changed file_id type from u32 to fsfileid.
04/01/2004 Initial version.