write(const uint8_t *buf, size_t size) from SD

I am trying to write a struct to a file on an SD card.

this is the struct:

struct record {
   time_t time;
   unsigned int    p1023;
   unsigned int    t1023;
} rec;

and to write it, I thought to use the write function of SD, in this case the file instance is "logfile" :


but I get "no matching function for call to 'File::write(record&,unsigned int);
I understand it's a type issue, I tried modifiers and pointers, but it doesn't want to work, any help?

with kind regards,


Without seeing the function prototype for write, try:




logfile.write((byte *) &rec,sizeof(rec));

Thanks Nick, the 2nd one did it.