FS_ReadDirectory[W]

# FS_ReadDirectoryW

## Syntax

    #include <nitro/fs.h>

    BOOL FS_ReadDirectory(FSFile *dir, FSDirectoryEntryInfo *info);
    BOOL FS_ReadDirectoryW(FSFile *file, FSDirectoryEntryInfoW *info);

## Arguments

dir | The `FSFile` structure with the directory handle.
info | The `FSDirectoryEntryInfo` or `FSDirectoryEntryInfoW` structure where the entry information should be stored when it is obtained.

## Return Values

Returns `TRUE` if the entry information was obtained properly; returns `FALSE` otherwise. In case of failure, use the `FS_GetResultCode` function to get the error details.

## Description

Reads only one item of entry information from a directory handle. Each time this function is called, the list position in the directory is incremented by 1. After the final entry is reached, it returns `FALSE`. For example, suppose you use the `FS_OpenDirectory` function to open a directory that contains three files. When you call this function using that handle, it returns a value of `TRUE` three times. It returns a value of `FALSE` the fourth time and thereafter.

Use the `FS_ReadDirectory` function to get the `longname` field from the entry information in Shift_JIS encoding. Use the `FS_ReadDirectoryW` function to get the same field in UTF-16LE. FAT file systems, such as SD Card archives, may use characters that cannot be expressed with Shift_JIS.

Entry information for TWL-exclusive files can be obtained even when the system is operating in NITRO mode. You can determine whether access to the file is actually possible by checking the FS_ATTRIBUTE_IS_OFFLINE flag of the `attributes` field.

## Note

- This function cannot be called from the interrupt handler (IRQ mode). Also, in some cases processing may not end if interrupts are still disabled.

## See Also

`FSFile`
`FSDirectoryEntryInfo`
`FS_OpenDirectory`
`FS_CloseDirectory`

## Revision History

2009/06/08 Added link to explanation of TWL-exclusive files.
2009/01/08 Added an explanation about TWL-exclusive files.
2008/09/02 Added notes concerning a Unicode version of the function.
2007/09/18 Initial version.

CONFIDENTIAL