A S / Mbed 2 deprecated aos_mbed

Dependencies:   C12832_lcd EthernetInterface USBHost mbed-rtos mbed wave_player

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers usb.cpp Source File

usb.cpp

00001 /* FILE: usb.cpp by Chu Van Thiem
00002 */
00003 #include "usb.h"
00004 
00005 usb::usb(const char * rootdir) : USBHostMSD(rootdir)
00006 {
00007     // Clear list of files
00008     filenames.clear();
00009 }
00010 
00011 void usb::listdir(const char *dir) {
00012     DIR *d;
00013     struct dirent *p;
00014     
00015     d = opendir(dir);
00016     if (d != NULL) {
00017         filenames.clear();
00018         while ((p = readdir(d)) != NULL) {
00019             //printf(" - %s\n", p->d_name);
00020             filenames.push_back(string(p->d_name));
00021         }
00022     } else {
00023         printf("Could not open directory!\n");
00024     }
00025     closedir(d);
00026 }