Using the new Arduino IDE for ESP8266 and found bugs, report them here

Moderator: igrr

User avatar
By ian
#51043 Hi all, I've been away from here for a while & downloaded the latest (stable) s/w today.
My problem concerns existing code that I wrote a while ago which no longer compiles.
The code (attached) restores 10 files from SPIFFS. It just copies files. This compiled fine & worked fine until today when I updated everything. It seems that [i]file[/i].readBytes & [i]file[/i].write are now mutually incompatible(?)

I can't seem to get away from:
invalid conversion from 'byte* {aka unsigned char*}' to 'char*' [-fpermissive]
Whatever I try :(
This is the code:

Code: Select all[code][code
void recover()
{
  Serial.println("In recover");     //debug

  byte ibuffer[64];   //declare a buffer - hopefully this speeds things up...

  const String source[] = {"/indexCopy.htm", "/gaugesCopy.htm", "/faviconCopy.ico", "/Mback15Copy.jpg", "/nakedCopy.jpg", "/odCopy.jpg", "/styleCopy.css", "/xmlCopy.js", "/gaugeCopy.js", "/helpCopy.html"};
  // above are backup files
  const String dest[] = {"/index.htm", "/gauges.htm", "/favicon.ico", "/Mback15.jpg", "/naked.jpg", "/od.jpg", "/style.css", "/xml.js", "/gauge.js", "/help.html"};
  // above are where the backup files will go

  for (int i = 0; i < 10; ++i)    //restore all 10 files
  {
    File f1 = SPIFFS.open(source[i], "r");    //open source file to read
    if (!f1) {
      Serial.println("file open" + source[i] + " failed");  //debug
    }
    File f2 = SPIFFS.open(dest[i], "w");    //open destination file to write
    if (!f2) {
      Serial.println("file open" + dest[i] + " failed");    //debug
    }
    while (f1.available() > 0)
    {
      byte i = f1.readBytes(ibuffer, 64); // i = number of bytes placed in buffer from file f1
      f2.write(ibuffer, i);               // write i bytes from buffer to file f2
    }
    f2.close(); // done, close the destination file
    Serial.println("Done copying" + dest[i]);     //debug
    f1.close(); // done, close the source file
  }
  server.send(200, "text/plain", "Recovery complete");
}


[/code]
[/code]

Thoughts appreciated.

Ian