esemi00
Dependencies: mbed FatFileSystemCpp
mainUSB1.cpp
00001 //mainUSB1.cpp 00002 #include "mbed.h" 00003 #include "MSCFileSystem.h" 00004 #define FSNAME "usb"//FATファイルシステムのマウント名(任意) /マウント名 がルートディレクトリ 00005 00006 Serial pc(USBTX,USBRX); 00007 MSCFileSystem msc(FSNAME); //USBフラッシュメモリを/usbにマウントして使用するため宣言 00008 00009 int main(){ 00010 DIR *d;//ディレクトリ 00011 struct dirent *p; //ディレクトリ内情報(ファイル名、ファイルタイプ) 00012 00013 d = opendir("/" FSNAME); //ルートディレクトリをオープン 00014 00015 pc.printf("\nList of files on the flash drive:\r\n"); 00016 00017 if ( d != NULL ) { 00018 while ( (p = readdir(d)) != NULL ) { //ルートディレクトリ内情報読み出し 00019 pc.printf(" - %s\n", p->d_name); //ファイル名を表示 00020 } 00021 } else { 00022 pc.printf("Could not open directory!\r\n"); 00023 } 00024 } 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 //d = opendir("/" FSNAME "/web"); 00035 00036
Generated on Sat Apr 15 2023 21:30:38 by 1.7.2