NANDReadDir

C Specification


#include <revolution/nand.h>

#define NAND_MAX_NAME          12

s32 NANDReadDir(const char *dirName, char *nameList, u32 *num);

Arguments

dirName Directory name.
nameList Buffer start address for storing the file and directory list that is contained in the specified directory. This buffer must be aligned on a 32-byte address boundary. If NULL is specified, the list is not stored.
num Stores the number of files and directories that are contained in the specified directory.

Return Values

Returns one of the following codes:

NAND_RESULT_OK
NAND_RESULT_ACCESS
NAND_RESULT_INVALID
NAND_RESULT_NOEXISTS
NAND_RESULT_UNKNOWN
NAND_RESULT_FATAL_ERROR

Description

Gets a list of files and directories contained in the specified directory. If the list size is unknown, retrieve the list using the following steps.

  1. Call this function with the second argument set to NULL. The number of elements in the list is written to the location pointed to by num.
  2. Allocate a memory block with the size [ (Number of Elements) x (NAND_MAX_NAME+1)] or larger.
  3. Call this function again with the allocated memory start address as the second argument.
  4. The number of elements of the list that was retrieved is stored in num (this value may be less than the value in the first call to this function), and the file and directory list with a null character separator is stored in the allocated memory.

See Also

NANDReadDirAsync

Revision History

06/16/2006 Initial version.