WebbotLib AVR library
WebbotLib It just does it
  C++ documentation  C documentation

findFirst

Find the first file entry in a directory.
Returns FALSE if the directory doesn't exist or contains no files. Otherwise it will return TRUE and the specified iterator is initialised with the first file entry.
Syntax
Disk. findFirst(iterator,dirFind)
 
Parameters
TypeNameDescription
'iterator'
The FileIterator variable that is to be initialised by this call.
'dirFind'
The name of the directory to search within.
Returns
boolean
Example
Assuming your disk is called disk_sdCard then you can list the files in the root folder using:
FileIterator f;
boolean ok = disk.findFirst(f, "/");
while(ok){
    cout.print( f.getName() );
    count.print('(').print(f.getSize()).print_P(PSTR(") bytes"))
    if(f.isDirectory(){
        cout.print_P( PSTR(" <dir>") );
    }
    cout.println();
    ok = f.findNext();
}

 

 

Valid XHTML 1.0 Transitional