# 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 `FS_GetResultCode()` 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 within the directory will be incremented by one. After the final entry is reached, it will return FALSE. For example, let's say you use the `FS_OpenDirectory()` function to open a directory that contains three files. When you call this function using that handle, it will return a value of TRUE three times. It will return a value of FALSE the fourth time and thereafter.

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

The entry information for TWL-only files is available 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. (For more information on the specification of TWL-only files, see the explanation about the `Put` parameter in makerom.TWL.)

## Note

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

## See Also

`FSFile
FSDirectoryEntryInfo
FS_OpenDirectory
FS_CloseDirectory`

## Revision History

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

CONFIDENTIAL