DirectoryList library test program for SD card operation

Dependencies:   DirectoryList SDFileSystem mbed

Just a sample code of DirectoryList library works with SDFilesystem.
/media/uploads/okano/---------_2015-06-04_10.28.47.png

Files at this revision

API Documentation at this revision

Comitter:
okano
Date:
Thu Jun 04 01:27:15 2015 +0000
Commit message:
initial version

Changed in this revision

DirectoryList.lib Show annotated file Show diff for this revision Revisions of this file
SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 6c4b536215c2 DirectoryList.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DirectoryList.lib	Thu Jun 04 01:27:15 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/okano/code/DirectoryList/#3cd1685a4c22
diff -r 000000000000 -r 6c4b536215c2 SDFileSystem.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Thu Jun 04 01:27:15 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/mbed/code/SDFileSystem/#7b35d1709458
diff -r 000000000000 -r 6c4b536215c2 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jun 04 01:27:15 2015 +0000
@@ -0,0 +1,37 @@
+#include    "mbed.h"
+#include    "SDFileSystem.h"
+#include    "DirectoryList.h"
+
+SDFileSystem sd( p5, p6, p7, p8, "sd" );
+
+#define     TARGET_DIRECTORY    "/sd/DCIM/100D3100"
+
+int main(void)
+{
+    printf( "\r\n  == DirectryList test with SDFileSystem ==\r\n" );
+    printf( "accessing to \"%s\"\r\n", TARGET_DIRECTORY );
+    //
+    //  make an instance and get file name list
+    //
+    
+    DirectoryList   dir( TARGET_DIRECTORY );
+
+    //
+    //  check if the directory list is obtained successfully
+    //
+    
+    if ( dir.error_check() )
+        error( "directory could not be opened\r\n" );
+
+    //
+    //  show file names
+    //  each file names are given as std::string object
+    //  (call "c_str()" if you need to convert to "char *")
+    //
+    //  this sample shows the file name displayed by printf
+    //  with converting string class to normal-C-string 
+    //
+        
+    for ( int i = 0; i < dir.size(); i++ )
+        printf( "%s\r\n", dir[ i ].c_str() );
+}
diff -r 000000000000 -r 6c4b536215c2 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jun 04 01:27:15 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/cbbeb26dbd92
\ No newline at end of file