-
- // Open binary file and dump buffer into it
- FILE * file = fopen(s->filename, "wb");
- if (file == NULL)
- {
- Fatal("Couldn't open file \"%s\" mode wb - %s", s->filename, strerror(errno));
- }
- fseek(file, 0, SEEK_END);
- int amount_written = fwrite(s->buffer, sizeof(DataPoint), SENSOR_DATABUFSIZ, file);
+ fseek(s->file, 0, SEEK_END);
+ int amount_written = fwrite(s->buffer, sizeof(DataPoint), SENSOR_DATABUFSIZ, s->file);