Delete_file prog

Dependencies:   SDFileSystem mbed

Fork of mbed_blinky by Mbed

main.cpp

Committer:
jaspreetsingh
Date:
2015-02-16
Revision:
7:55590c7bed67
Parent:
4:81cea7a352b0
Child:
8:99956653b8c8

File content as of revision 7:55590c7bed67:

#include "mbed.h"
#include "SDFileSystem.h"


SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd");
Serial pc(USBTX, USBRX);

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");
        
}