remove() not working on Wio Terminal, while readBytes() & write() working fine in similar code. Project at standstill without being able to deleted files.
Any & all help appreciated! Thank You! Bob
Code:
#include <SPI.h>
#include <Seeed_FS.h>
#include “SD/Seeed_SD.h”
…
//Delete all files in UnScrambleOut:
inDir = SD.open(“UnScrambleOut”, FILE_READ | FA_WRITE | FA_OPEN_EXISTING);
if (inDir.isDirectory()) {
inFile = inDir.openNextFile(FA_READ | FA_WRITE | FA_OPEN_EXISTING);
Serial.println("8 ");
Serial.println(inFile.name());
while (inFile.available()) {
result = remove(&inFile.name()[0]);//TODO NOT WORKING!
strcpy(debug_output, "result from remove() = ");
itoa(result, &debug_output[strlen(debug_output)], 10);
Serial.println(debug_output);
inFile = inDir.openNextFile(FA_READ | FA_WRITE | FA_OPEN_EXISTING);
Serial.println("9 ");
Serial.println(inFile.name());
}
}
inDir.close();
Results from 3 files in directory:
SDCARD initializeed.
8
0:/UnScrambleOut/AbC.txt
result from remove() = -1
9
0:/UnScrambleOut/ASCII.txt
result from remove() = -1
9
0:/UnScrambleOut/Wio Terminal Serial
result from remove() = -1
9
Also tried stripping leading “0:/“ & “0:” and got the same results.