Storing a character string in list of leaves

Hello,

I have the following branch declaration for TTree

tevent->Branch("clkb_event_gps", &Gps, "gps_id_tag/C:gps_time/F:gps_date:gps_lat:gps_lon:gps_alt:gps_lat_unf:gps_lon_unf:gps_alt_unf:gps_speed:gps_course:gps_time_ns/I:gps_oscillator_offset:gps_speed_2d/s:gps_dop/S:gps_clock_bias:gps_osc_temp:gps_sat_mode[12]:gps_channels_status[12]:gps_receiver_status:gps_sat_num/b:gps_sat_num_tracked:gps_svid[12]:gps_sig_strength[12]:gps_iode[12]:gps_time_mode/B:gps_offset_signed_byte:gps_offset_hour:gps_offset_minute:gps_crc");

with Gps structure starting as:

struct gps_struct_spb
{
	// Binary part
	// One byte added for '\0'
	char id_tag[7];	

	float time;
	float date;

the id_tag is terminated by

gps->id_tag[6]='\0'; // Terminate with \0 for ROOT

When I read the written tree, the gps_id_tag contains a proper value, but the following gps_time and gps_date contain rubbish. When I remove the gps_id_tag from the branch definiotion and id_tag from the C structure, everything seems to be fine. What am I doing wrong? Maybe the character string should not be at the beginnign of the branch?

ROOT 5.34.

Search for “padding” in the TTree class description.
In general, you need to have a compiled dictionary for “gps_struct_spb”.
If you need it “interpreted”, try: struct gps_struct_spb { float time; float date; // ... another leaves ... char id_tag[7]; }

Thank you! I suspected padding, but didn’t know where the C should be put. In theory it is the biggest, so should come at beginning of the leave, if one does not think properly on this. Maybe an update in the docs?