Delete_file prog

Dependencies:   SDFileSystem mbed

Fork of mbed_blinky by Mbed

Revision:
7:55590c7bed67
Parent:
4:81cea7a352b0
Child:
8:99956653b8c8
--- a/main.cpp	Fri May 09 19:58:03 2014 +0300
+++ b/main.cpp	Mon Feb 16 12:28:30 2015 +0000
@@ -1,12 +1,26 @@
 #include "mbed.h"
+#include "SDFileSystem.h"
 
-DigitalOut myled(LED1);
+
+SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd");
+Serial pc(USBTX, USBRX);
 
-int main() {
-    while(1) {
-        myled = 1;
-        wait(0.2);
-        myled = 0;
-        wait(0.2);
-    }
-}
+int main()
+{
+    mkdir("/sd/jas",0777);
+    pc.printf("Hello World\r\n");
+    wait(3);
+    pc.printf("Creating test1.txt\r\n");
+    FILE *fp = fopen("/sd/test1.txt","w");
+    fprintf(fp,"Hello World");
+    fclose(fp);
+    pc.printf("File Created\r\n");
+    wait(3);
+    pc.printf("Deleting the File\r\n");
+    wait(3);
+    char dest[100]="";
+    sprintf(dest,"/sd/test1.txt");    // Write the name of the file you want to delete from the sd card or empty folder
+    remove(dest);
+    pc.printf("File Deleted\r\n");
+        
+}
\ No newline at end of file