![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
dsfa
Dependencies: dsf SDFileSystem TextLCD mbed stepper_moter
Fork of my_example_Nucleo_Ex05_SD_zhangyuxiang2 by
SDRead/SDRead.cpp
- Committer:
- brainliang
- Date:
- 2018-05-08
- Revision:
- 4:c88bf297ee75
File content as of revision 4:c88bf297ee75:
#include "SDRead.h" SDRead::SDRead(PinName mosi,PinName miso,PinName sclk,PinName cs,const char *name):SDFileSystem(mosi,miso,sclk,cs,name) {} bool SDRead:: Get_FileDir() { this -> mount(); DirHandle *dh = opendir("/sd/"); if(!dh){ return false; } dirent *entry; for(;;) { entry = dh -> readdir(); if(!entry) {break;} string dir_name = entry -> d_name; if(dir_name == "System Volume Information") continue; File_dir.push_back(dir_name); } dh -> closedir(); return true; } bool SDRead::Read_File(const char* FileName) { FILE *fp1 = fopen(FileName,"r"); if(fp1 == NULL) { return false; } char buf[200]; while(fgets(buf,sizeof(buf),fp1) != NULL) { string info = buf; Info.push_back(info); } return true; }