This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3200MOD: datalogging with sd card

Part Number: CC3200MOD

Hi,

I am having trouble finding a convenient way to write to the end of a file on an sd card. It appears that upon every open, the pointer is reset back to zero. I don't know that I want to have the file open all the time. Is there a better workaround here? Any help would be greatly appreciated.

Best,

Kyle

char *csv = (char*)malloc(30 * sizeof(char));
sprintf(csv, "%f,%f,%f", temperature, humidity, light);
		
Message("\n\n\rWriting sensor data to file...\n\r");
//TODO create file for each new day
res = f_open(&fp,FILE,FA_CREATE_ALWAYS|FA_WRITE);
if(res == FR_OK)
{
    f_write(&fp,csv,30,&Size);
    Report("Wrote : %d Bytes",Size);

    res = f_close(&fp);
}
else
{
    Message("Failed to create a new file\n\r");
}