ECE 4180 Labs / Mbed 2 deprecated 4180_Lab2_SD

Dependencies:   SDFileSystem mbed

Fork of 4180_Lab2_SD by Jeremy Cai

Revision:
1:d2b9f2f42fe5
Parent:
0:bdbd3d6fc5d5
--- a/main.cpp	Fri Dec 07 11:25:01 2012 +0000
+++ b/main.cpp	Sun Sep 25 19:03:25 2016 +0000
@@ -16,4 +16,20 @@
     fclose(fp); 
  
     printf("Goodbye World!\n");
+    
+    
+      // example of reading a file one byte at a time
+      // and display it in hex format on the terminal
+ 
+      unsigned char c;                          // a single byte buffer
+ 
+      fp = fopen("/sd/mydir/sdtest.txt", "r");  // open the file in 'read' mode
+ 
+      while (!feof(fp)){                        // while not end of file
+           c=fgetc(fp);                         // get a character/byte from the file
+           printf("%c",c);                  //
+      }
+      printf("\n\r");
+      fclose(fp);                               // close the file
+    
 }