You can chat about native SDK questions and issues here.

User avatar
By steeve
#95640 hello, i am trying to read a file from the spiffs image i have builìt and uploaded to esp.
Whatever file i try to open, when i read it i get null.

Code: Select all    struct stat st;
    stat("/spiffs/index.html", &st);
    ESP_LOGI(TAG, "index.html size is %ld", st.st_size);

    ESP_LOGI(TAG, "Reading file");
    FILE* f = fopen("/spiffs/index.html", "r");
    char line[32];
    fgets(line, sizeof(line), f);
    ESP_LOGI(TAG, "Read from file: '%s'", line);
    fclose(f);


this code produces the following log:
Code: Select allI (435) wifi softAP: index.html size is 546
I (437) wifi softAP: Reading file
I (444) wifi softAP: Read from file: ''



i have generated the image with mkspiffs. i also have tryed recompiling mkspiffs with SPIFFS_USE_MAGIC_LENGTH: 4 instead of 1 but nothing changes.
Any ideas??