SD.remove either complains during compile or crashes
Posted: Mon Oct 16, 2017 8:11 am
Code: Select all
SD.remove("test.txt");
Z:\@Mikes Files\@Programming\@Arduino\@Sketches\@ESP8266 Sketches\Read_Write_Struct_Test\Read_Write_Struct_Test.ino:110:25: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
All of the web examples do it this way. Would like to get rid of the error message.
...or...
Code: Select all
String STestFN = "test.txt";
SD.remove(STestFN);
The compiler no longer complains but the program crashes with:
ets Jan 8 2013,rst cause:4, boot mode:(1,6)
wdt reset
Same problem with SD.exists but not with SD.open
...so...
I changed to:
Code: Select all
const char *STestFN = "test.txt";
and got:
Exception (29):
epc1=0x4000e177 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00001af9 depc=0x00000000
ctx: sys
sp: 3fff1870 end: 3fffffb0 offset: 01a0
Is there a fourth option that will make everyone happy?
Definitions I found (look so similar):
File SDClass::open(const char *filepath, uint8_t mode) {
boolean SDClass::remove(char *filepath) {