Skip to content

SPIFFS - Error trying to open an empty created file #1126

Closed
@platenyponchet

Description

@platenyponchet

Obs.: It's ok to open in read mode.
The code is here:

#include "FS.h"
//#include <ArduinoJson.h>

File f;

void setup() {
    Serial.begin(115200);
    Serial.println("");
    delay(1000);
    Serial.println("Mounting FS...");

    if (!SPIFFS.begin()) {
        Serial.println("Failed to mount file system");
        return;
    }

    SPIFFS.format();
    f = SPIFFS.open("/test.txt", "w");
    f.close();
    f = SPIFFS.open("/test.txt", "w");
    if(!f) Serial.print("Error.");
    else Serial.print("Ok."); 
    f.close();  
}

void loop() {

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions