# FSDirEntry

## Definition

  `#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. The structure members are described below.

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 `NULL`.
name | A string (a file or directory name). The `FS_ReadDir` function will append a terminating `"\0"` to this string.

## Note

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

## See Also

`FSDirPos FS_OpenFileFast FS_ReadDir FS_SeekDir FS_FILE_NAME_MAX`

## Revision History

2004/05/14 Changed `file_id` type from `u32` to `fsfileid`.

2004/04/01 Initial version.

CONFIDENTIAL