Hi Buddy, I have modified the snip you sent and get the following error when I compile. Any ideas why the min function is causing this issue? PS: Spiffs.begin is called in setup of the sketch.
error:
C:\ARDUINO\arduino-1.6.5\arduino-1.6.5-r2\portable\packages\esp8266\hardware\esp8266\1.6.5-1044-g170995a\cores\esp8266/Arduino.h:252:18: error: expected unqualified-id before '(' token
#define min(a,b) ((a)<(b)?(a):(b))
^
SPIFFS_MOD.ino:14:27: note: in expansion of macro 'min'
Error compiling.
New routine:
void ShowLargeFile()
{
File f = SPIFFS.open("/Config.cfg", "r");
if (!f) {
Serial.println("Can't open Config.cfg !\r\n");
}
else {
char buf[1024];
int siz = f.size();
while(siz > 0) {
size_t len = std::min((int)(sizeof(buf) - 1), siz);
f.read((uint8_t *)buf, len);
buf[len] = 0;
Serial.println(buf);
siz -= sizeof(buf) - 1;
}
f.close();
}
}
cheers Dans