pellepl / spiffs

Wear-leveled SPI flash file system for embedded devices
MIT License
1.5k stars 402 forks source link

problems with your demo code #251

Open jamesben6688 opened 4 years ago

jamesben6688 commented 4 years ago

When I try to use your demo code in https://github.com/pellepl/spiffs/wiki/Using-spiffs like below:

spiffs_file fd = SPIFFS_open(FS, "my_file", SPIFFS_CREAT | SPIFFS_TRUNC | SPIFFS_RDWR, 0);

I always get a negative fd. Is there anything else should be done to make this correct?

jtonti commented 4 years ago

There could be one or more things wrong. Try printing out the value of fd returned when the call fails and checking the error code list in github here https://github.com/pellepl/spiffs/blob/master/src/spiffs.h. This might give you a clue for further investigation.