taichi yanagisawa / Mbed 2 deprecated SDFileSystem_Load

Dependencies:   TextLCD mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "SDFileSystem.h"
00003 
00004 SDFileSystem sd(p5, p6, p7, p8, "sd");
00005 const unsigned int MAX_LEN = 256;
00006 
00007 int main() { 
00008     FILE* fp = fopen("/sd/mydir/sdtest.txt", "r");
00009     if(fp == NULL) {
00010         error("Could not open file for write\n");
00011     }
00012     
00013     char str[MAX_LEN];
00014     fgets(str,MAX_LEN-1,fp);
00015     
00016     printf(str);
00017     fclose(fp); 
00018 }