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" :

   logfile.write(rec,sizeof(rec));

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,

Carlos

Without seeing the function prototype for write, try:

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

(edit)

or:

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

Thanks Nick, the 2nd one did it.