Jump to content
43oh

blannoy

Members
  • Content Count

    2
  • Joined

  • Last visited

  1. I don't want the data to be overwritten every time I open the file for logging. So that's why I thought to add the current size of the data as a 4byte header of the file that I read every time the file is opened. That's the first lseek. Then I write the data and keep track of the size of the data output to the file. After the data is logged I have to update my file header. So I do an lseek(0) to rewind. There things seem to go wrong because I end up with an updated header and an emtpy file. If I do not update the file header the data is in the file. It seems that the data is not written to
  2. Hi, I'm trying to use an SDCard as a datalogger. I can write to the card using the sample. I want to append the data and for that I'm using a 4 byte header in the file. It seems that when I want to update the header after a logging session all the data is missing from the file as well. What am I doing wrong: ... rc = FatFs.open("T_WRITE.TXT"); if (rc) die(rc); char buffer[4]; rc = FatFs.read(buffer, sizeof(buffer), &br); /* Read a chunk of file */ if (rc || !br) die(rc); /* Error or end of file */ for (uint16_t i = 0; i < br; i++){ fileIndex.myByte[i]=buffer[i
×
×
  • Create New...