Go Down

Topic: Delete files on SD card (Read 2947 times) previous topic - next topic



I am trying to right a function that clears all files on the SD card. This is my function. It doesnt do anything. help me please!

void clearSDcard()
  char filname = root.openNextFile();
    SD.remove(&filname);//returns filename
    Serial.println("File removed");
  Serial.println("All files deleted from card");


Code: [Select]
    SD.remove(&filname);//returns filename
I hardly think that a method called remove() returns a file name as its primary purpose.

On most operating systems, you can't delete an open file. I'm not sure why you think that the Arduino would be an exception.

Code: [Select]
  char filname = root.openNextFile();
This is clearly wrong. The openNextFile() method does not return the opened file's name as a single character.
The art of getting good answers lies in asking good questions.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131