Effortless SPIFFS not compiling

Hi all,

I'm using the Effortless SPIFFS library:

#include <Effortless_SPIFFS.h>

Writing to SPIFFS using this tool seems to be a breeze, but I haven't been able to test it as the reading command is failing to compile. As per the documentation on eSPIFFS I'm using this to make the retrieve call:

    if (fileSystem.openFromFile("mqtt_ip.txt", mqtt_ip)) {
        Serial.println("Got mqtt_ip value");
    }

But I'm getting an error when compiling:
no matching function for call to 'eSPIFFS::openFromFile(const char [12], char [11])'

Here is the Github site for it: GitHub - thebigpotatoe/Effortless-SPIFFS: A class designed to make reading and storing data on the ESP8266 and ESP32 effortless

Any idea what I'm doing wrong here?

Since you didn't both to show us all your code, I have to guess that 'mqtt_ip' is a char array. From the library's README, you can see the types that are supported for the second argument to openFromFile, char array is not one of them:

// Definitions
bool openFromFile(const char*, &bool);
bool openFromFile(const char*, &float);
bool openFromFile(const char*, &double);
bool openFromFile(const char*, &signed char);
bool openFromFile(const char*, &unsigned char);
bool openFromFile(const char*, &signed int);
bool openFromFile(const char*, &unsigned int);
bool openFromFile(const char*, &signed short);
bool openFromFile(const char*, &unsigned short);
bool openFromFile(const char*, &signed long);
bool openFromFile(const char*, &unsigned long);
bool openFromFile(const char*, &char*);
bool openFromFile(const char*, &const char*);
bool openFromFile(const char*, &String);
bool openFromFile(const char*, &std::string);
bool openFromFile(const char*, &ArduinoJson::DynamicJsonDocument);

Looking in Effortless_SPIFFS.h, it seems you may want to pass a 'char *' or a 'const char *'. The function should then load the from the file and store in a local static buffer. It will then set your pointer to point at this buffer. I'd think you'd want to copy the contents out of that buffer before calling openFromFile again.

gfvalvo:
you may want to pass a 'char *' or a 'const char *'

Spot on. Your guess was right about my char array. I just didn't realise char* is not the same. Novice coder.

Thankyou :slight_smile: