How to create a list of files inside a dir

How can I create a list of files/dirs inside a specific dir?

I want to emulate the “ls” function.

Hello

You should look at API NAFSlist_dir(). It is used in conjunction with API NAFSdir_entry_count(). NAFSdir_entry_count returns the number of entries available. This is passed to NAFSlist_dir so that NAFSlist_dir knows how much space to allocate.

These are described in the API reference guide at:
System Software Services->File System->Flash File System->Functions.

Please ignore the fact that this is listed under Flash File System, it works equally well with the FLASH file and the RAM file system.

1 Like