Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By martinayotte
#52945 Some other person faced also the issue :
viewtopic.php?f=28&t=11199&p=52939#p52939

Quoting my self here :

Ok ! I found the reason here and it is hiding probably a compiler issue, but there is a workaround.
The diagnostic reveal that "boolean remove(const String &filepath) { return remove(filepath.c_str()); }" is calling itself in an infinite recursion.
Two solutions are possible, one is to add "char *" casting in "remove((char *)filepath.c_str());", but I think it would be better to change the other method to be "boolean remove(const char *filepath);", but that would mean adding "const" in many places.
User avatar
By treii28
#53536 I am having the same problem and noticed this bugfix thread. I see something further down claiming it was fixed, but as I say, I am getting the same crash when running SD.exists on a string for a directory name (that does exist).

https://github.com/arduino/Arduino/issues/3999

I have a feeling you have to make sure it is passed a char array. I ended up doing:

Code: Select all  String d = (server.hasArg("dir")) ? server.arg("dir") : "";
  d.trim();
  char dChar[d.length()+1];
  d.toCharArray(dChar,d.length()+1);


then used the dChar value for SD.exists() (in a block that checks to make sure it's not "/" and not "") and it stopped crashing.
User avatar
By martinayotte
#53572 As I said in another thread, I've fixed the issue, but it is not merged yet.
https://github.com/esp8266/Arduino/pull/2398
But, in the mean time, you can workaround by simply casting the String to "char *" :
Code: Select allString d = ... whatever ...
SD.exists((char *)d.c_str())


EDIT : Ok ! It is now merged into github ...