Sample code for DirectoryList class library

Dependencies:   DirectoryList mbed

Information

Use of this sample code is described in library page.
https://developer.mbed.org/users/okano/code/DirectoryList/

このサンプルコードの使い方の説明は,ライブラリのページで解説されています. https://developer.mbed.org/users/okano/code/DirectoryList/

Revision:
0:f31922ea4d33
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jan 23 22:37:50 2015 +0000
@@ -0,0 +1,42 @@
+/**
+ *  DirectoryList library demo program
+ *
+ *  @author  Tedd OKANO
+ *  @version 0.1
+ *  @date    Jan-2015
+ *
+ *  A simple directory listing interface.
+ */
+
+#include "mbed.h"
+#include "DirectoryList.h"
+
+LocalFileSystem local( "local" );
+
+int main(void)
+{
+    //
+    //  make an instance and get file name list
+    //
+    
+    DirectoryList   dir( "/local" );
+
+    //
+    //  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() );
+}