Directry file listing class Instance will be a vector of string class which holds the file name of given path.

Dependents:   ika_shouyu_poppoyaki DirectoryList_Hello ika_shouyu_poppoyaki eVY1_SMF_player ... more

You are viewing an older revision! See the latest version

Homepage

Table of Contents

  1. What is this?
  2. How to use?

What is this?

A class to list files of a directory (folder).

When the instance is made, it access to the directory information and keeps the file names as vector of strings.

This class can be used for any file system which is supported by mbed's file systems like LocalFileSystem and MSCFileSystem (SD has not been tested yet).

How to use?

The usage is very simple.

  1. Make a instance with path make to the directory
  2. Check error status
  3. The file names are available as vector of strings inside of instance.

#include "mbed.h"
#include "DirectoryList.h"

LocalFileSystem local( "local" );

int main(void)
{
    DirectoryList   dir( "/local" );

    if ( dir.error_check() )
        error( "directory could not be opened\r\n" );

    for ( int i = 0; i < dir.size(); i++ )
        printf( "%s\r\n", dir[ i ].c_str() );
}

Import programDirectoryList_Hello

Sample code for DirectoryList class library

Information

The file names are in 8.3 format (old DOS type file name fomat: 8 characters file name with 3 characters suffix).


All wikipages