![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Delete_file prog
Dependencies: SDFileSystem mbed
Fork of mbed_blinky by
main.cpp@7:55590c7bed67, 2015-02-16 (annotated)
- Committer:
- jaspreetsingh
- Date:
- Mon Feb 16 12:28:30 2015 +0000
- Revision:
- 7:55590c7bed67
- Parent:
- 4:81cea7a352b0
- Child:
- 8:99956653b8c8
Delete_file prog
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dan | 0:7dec7e9ac085 | 1 | #include "mbed.h" |
jaspreetsingh | 7:55590c7bed67 | 2 | #include "SDFileSystem.h" |
dan | 0:7dec7e9ac085 | 3 | |
jaspreetsingh | 7:55590c7bed67 | 4 | |
jaspreetsingh | 7:55590c7bed67 | 5 | SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd"); |
jaspreetsingh | 7:55590c7bed67 | 6 | Serial pc(USBTX, USBRX); |
dan | 0:7dec7e9ac085 | 7 | |
jaspreetsingh | 7:55590c7bed67 | 8 | int main() |
jaspreetsingh | 7:55590c7bed67 | 9 | { |
jaspreetsingh | 7:55590c7bed67 | 10 | mkdir("/sd/jas",0777); |
jaspreetsingh | 7:55590c7bed67 | 11 | pc.printf("Hello World\r\n"); |
jaspreetsingh | 7:55590c7bed67 | 12 | wait(3); |
jaspreetsingh | 7:55590c7bed67 | 13 | pc.printf("Creating test1.txt\r\n"); |
jaspreetsingh | 7:55590c7bed67 | 14 | FILE *fp = fopen("/sd/test1.txt","w"); |
jaspreetsingh | 7:55590c7bed67 | 15 | fprintf(fp,"Hello World"); |
jaspreetsingh | 7:55590c7bed67 | 16 | fclose(fp); |
jaspreetsingh | 7:55590c7bed67 | 17 | pc.printf("File Created\r\n"); |
jaspreetsingh | 7:55590c7bed67 | 18 | wait(3); |
jaspreetsingh | 7:55590c7bed67 | 19 | pc.printf("Deleting the File\r\n"); |
jaspreetsingh | 7:55590c7bed67 | 20 | wait(3); |
jaspreetsingh | 7:55590c7bed67 | 21 | char dest[100]=""; |
jaspreetsingh | 7:55590c7bed67 | 22 | sprintf(dest,"/sd/test1.txt"); // Write the name of the file you want to delete from the sd card or empty folder |
jaspreetsingh | 7:55590c7bed67 | 23 | remove(dest); |
jaspreetsingh | 7:55590c7bed67 | 24 | pc.printf("File Deleted\r\n"); |
jaspreetsingh | 7:55590c7bed67 | 25 | |
jaspreetsingh | 7:55590c7bed67 | 26 | } |