Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SDFileSystem mbed
Fork of 4180_Lab2_SD by
Diff: main.cpp
- 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
+
}
