Send an array of byte with serial.write using struct

Hello,

I need send by serial.write() a struct, only the 18 bytes must be send, no one before ou after.

typedef struct{

uint64_t timeStamp=1568924432342; //8 bytes
uint16_t stationNameSize=8; //2 bytes 'required'
String stationName="station1"; //8 bytes

}envelope;

If I do:

Envelope envelope;
Serial.write((uint8_t*)&envelope,18);

It should be work? There is another way ? thankss :slight_smile:

sizeof (String) is always six, IIRC