I was wondering if it'd be hard to build a zeroed flag or something, that would make this work:
Precision byte `struc:"uint8"`
Name string `struc:"[7]uint8"`
}
the Name is 7 bytes, but it's zero padded at the end, I'd like to have the string without the zeroes, and pad back with zeroes when writing.. I tried pad.. but it seems to simply ignore the field, right ?
So the data: 0443555200000000 would deserialize to Currency{4, "CUR"} instead of Currency{4, "CUR\x00\x00\x00\x00"}.
Hi,
I was wondering if it'd be hard to build a
zeroed
flag or something, that would make this work:the Name is 7 bytes, but it's zero padded at the end, I'd like to have the string without the zeroes, and pad back with zeroes when writing.. I tried
pad
.. but it seems to simply ignore the field, right ?So the data:
0443555200000000
would deserialize toCurrency{4, "CUR"}
instead ofCurrency{4, "CUR\x00\x00\x00\x00"}
.