ftruncate() in Esp-LittleFS

StridingDragon
Posts: 46
Joined: Fri Aug 02, 2019 11:59 pm

ftruncate() in Esp-LittleFS

Postby StridingDragon » Wed Jul 28, 2021 1:24 am

I've been using LittleFS on the ESP32 for 2 years now and I'm really happy with it. Now, though, I tried to make an `ftruncate()` call to trim a file to size, only to find it's not implemented in the esp-littlefs virtual file system. LittleFS supports the function and the VFS even has a pointer member to the truncation function, but it not populated.

So I wrote my own function and added it to the VFS via the `.truncate_p` entry. However, when I compile, the linker throws the following error…

Code: Select all

undefined reference to `ftruncate'
Has anyone managed to successfully implement an ftruncate() function in the `esp-littlefs`? How did you go about it?

Who is online

Users browsing this forum: No registered users and 225 guests