Hi!
I tried adapting the following topic on how to write a byte-array to a binary file:
link
But after writing, when I open the file, there is 0 bytes.
My code:
#include <SPIFFS.h>
if(!SPIFFS.begin(true)){
Serial.println("An Error has occurred while mounting SPIFFS");
}
#define frame_total 50688
byte mem[frame_total];
for ( unsigned int i=0; i<frame_total; i++) {
mem[i] = 0x00; // fill with '0's
}
File file = SPIFFS.open("/test.bmp", "wb"); // binary write mode
file.write(mem, frame_total);
file.close();
//test size
File file2 = SPIFFS.open("/test.bmp", "rb"); // binary read mode
Serial.println(file2.size()); // Serial output result: 0
file2.close();
Please, how to write a byte or char array and retrieve it?
Thank you!