Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By brutzler
#25478
martinayotte wrote:
Code: Select all....
        File f = SPIFFS.open("/Tourlou.txt", "a");
        if (!f) {
          Serial.println("Can't open Tourlou.txt !\r\n");         
        }
        else {
          String str = "Il etait une fois ...\r\n";
          f.write((uint8_t *)str.c_str(), str.length());
          f.close();
        }
        File f = SPIFFS.open("/Tourlou.txt", "r");                 <---------------------------
......
        }



Here I get a redeclaration on compiling. IMHO only f = SPIFFS.open("/Tourlou.txt", "r");

But a good code-example to understand SPIFFS ;)

Edit:
Is it really possible to make different directories?
For testing, I changed :
Code: Select all    Dir dir = SPIFFS.openDir("/data");
-->
    Dir dir = SPIFFS.openDir("/data2");
and had the same files in both cases

Edit_2:
Does anybody get the file.seek function running?
With
Code: Select all  f.seek(3, SeekSet);
i only get a
SPIFFS_1:43: error: 'SeekSet' was not declared in this scope
SeekCur and SeekEnd does not better
User avatar
By martinayotte
#25485 Sorry for the compile redefinition error, this is copy/paste error since I didn't posted in my sketch context.

About Directories, SPIFFS is still young, so I don't think subdirectories are handled well yet, or there are maybe bugs.

File Seek ? you need to specify the namespace, exemple : fs::SeekEnd
User avatar
By brutzler
#25504 Hi,
no need for any apology.
We are glad, that you and others spend your time to bring forward such a project, or help us in our inexperience.

Directories: Yes, think I read somewhere, that it is not supportet yet.

File Seek ? you need to specify the namespace, exemple : fs::SeekEnd

Oh sorry. With my poor linux-knowledge, I do not understand what you want to tell me.
like this?
Code: Select allf.seek(3, fs::SeekEnd);

Can not test it now, cause earning money.....
User avatar
By martinayotte
#25524
brutzler wrote:Oh sorry. With my poor linux-knowledge, I do not understand what you want to tell me.
like this?
Code: Select allf.seek(3, fs::SeekEnd);


Yes, this is the proper syntax.