esemi00

Dependencies:   mbed FatFileSystemCpp

Revision:
4:09a962d3fe70
Parent:
0:e294af8d0e07
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mainUSB1.cpp	Wed Jan 20 05:25:16 2021 +0000
@@ -0,0 +1,36 @@
+//mainUSB1.cpp
+#include "mbed.h"
+#include "MSCFileSystem.h"
+#define FSNAME "usb"//FATファイルシステムのマウント名(任意) /マウント名 がルートディレクトリ
+
+Serial pc(USBTX,USBRX);
+MSCFileSystem msc(FSNAME);	//USBフラッシュメモリを/usbにマウントして使用するため宣言
+
+int main(){	
+	DIR *d;//ディレクトリ
+    struct dirent *p;			//ディレクトリ内情報(ファイル名、ファイルタイプ)
+    
+    d = opendir("/" FSNAME);		//ルートディレクトリをオープン
+    
+    pc.printf("\nList of files on the flash drive:\r\n");
+    
+    if ( d != NULL )    {
+        while ( (p = readdir(d)) != NULL ) {	//ルートディレクトリ内情報読み出し
+        	pc.printf(" - %s\n", p->d_name);	//ファイル名を表示
+		}
+    } else {
+        pc.printf("Could not open directory!\r\n");
+    }
+}
+
+
+
+
+
+
+
+
+
+//d = opendir("/" FSNAME "/web");
+  
+