SdFat-Particle
SdFat-Particle copied to clipboard
FatFile::open() fails creating new file with O_AT_END flag
open(fileName, O_CREAT | O_WRITE | O_AT_END) fails if <fileName> does not exist.
I ran the following program with a freshly formatted SD and the file test.txt was created.
The program printed:
Done
// This #include statement was automatically added by the Particle IDE.
#include <SdFat.h>
SdFat sd;
File file;
void setup() {
Serial.begin(9600);
Serial.println("type any character");
while (!Serial.available()) {}
if (!sd.begin()) {
Serial.println("begin");
}
if (!file.open("test.txt", O_CREAT | O_WRITE | O_AT_END)) {
Serial.println("open");
}
file.close();
Serial.println("Done");
}
void loop() {
}
I used a photon and the Particle web ide with firmware 6.3.
hmm, thanks for checking this Bill, a similar test fails consistently on my side. If I use O_CREAT | O_WRITE flags only, it works just peachy. But with O_AT_END as the third flag, file creation fails. I guess I have to dig in to see whats going on.