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: mbed-rtos mbed wolfSSL
Fork of sd_duplicator by
main.cpp@0:b453be3137c7, 2016-11-15 (annotated)
- Committer:
- tmasrat
- Date:
- Tue Nov 15 13:04:32 2016 +0000
- Revision:
- 0:b453be3137c7
- Child:
- 1:7827a11dc627
Cybersecurity project
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| tmasrat | 0:b453be3137c7 | 1 | #include "mbed.h" |
| tmasrat | 0:b453be3137c7 | 2 | #include "SDFileSystem.h" |
| tmasrat | 0:b453be3137c7 | 3 | |
| tmasrat | 0:b453be3137c7 | 4 | SDFileSystem original(p5, p6, p7, p22, "original"); |
| tmasrat | 0:b453be3137c7 | 5 | SDFileSystem duplicate(p11, p12, p13, p21, "duplicate"); |
| tmasrat | 0:b453be3137c7 | 6 | |
| tmasrat | 0:b453be3137c7 | 7 | DigitalOut myled(LED1); |
| tmasrat | 0:b453be3137c7 | 8 | |
| tmasrat | 0:b453be3137c7 | 9 | int main() { |
| tmasrat | 0:b453be3137c7 | 10 | printf("Hello World!\n"); |
| tmasrat | 0:b453be3137c7 | 11 | |
| tmasrat | 0:b453be3137c7 | 12 | FILE *fp = fopen("/original/fun.txt", "r"); |
| tmasrat | 0:b453be3137c7 | 13 | if(fp == NULL) { |
| tmasrat | 0:b453be3137c7 | 14 | error("Could not open file for read.\n"); |
| tmasrat | 0:b453be3137c7 | 15 | } |
| tmasrat | 0:b453be3137c7 | 16 | int c; |
| tmasrat | 0:b453be3137c7 | 17 | while((c = fgetc(fp)) != EOF){ |
| tmasrat | 0:b453be3137c7 | 18 | putchar(c); |
| tmasrat | 0:b453be3137c7 | 19 | } |
| tmasrat | 0:b453be3137c7 | 20 | fclose(fp); |
| tmasrat | 0:b453be3137c7 | 21 | |
| tmasrat | 0:b453be3137c7 | 22 | printf("Goodbye World!\n"); |
| tmasrat | 0:b453be3137c7 | 23 | |
| tmasrat | 0:b453be3137c7 | 24 | } |
