Question

I'm using Chan's FAT library that seems to provide a standard FAT filesystem API. The API doesn't seem to directly offer to list all the files in a given directory.

What is the standard way to list all files in a directory given access to a standard FAT API? Is there a special file (some "directory table"?) that I can access using f_read()?

Was it helpful?

Solution

Have a look at f_opendir and f_readdir:

The f_readdir function reads directory entries in sequence. All items in the directory can be read by calling f_readdir function repeatedly. When all directory entries have been read and no item to read, the function returns a null string into f_name[] member without any error. When a null pointer is given to the FileInfo, the read index of the directory object will be rewinded.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top