binary fwrite to SD-card

26 Apr 2012

I'm trying to write binary data to my SD-card in append mode. The result is flashing error leds. Can anybody see why my code doesn't work?

Thank you

#include "SDFileSystem.h"
SDFileSystem sd(p5, p6, p7, p8, "sd"); // mosi, miso, sclk, cs, name

    FILE *fp = fopen("/sd/meteodata.bin", "ab");
    if (fp ==NULL) {
        error("Could not open file for append\n");
        led2 = led3 = 1;
    } else {
        fwrite(&ctTime,sizeof(ctTime),1,fp);
        fwrite(&meteo_data,sizeof(meteo_data),1,fp);
    }
    fclose(fp);
21 Sep 2015

Did you ever find a solution to this?