String length
simon-p-r opened this issue · comments
Hi
How can I specify a string field with a known length? The string I am converting are c strings so the last char would have to be null.
Thanks
Simon
The byte[]
type is able to store any byte sequence, including sequences that contain null bytes. Is that what you're looking for?
Would syntax be like this
struct Project {
byte[40] prj_version;
byte[80] oldest_sxc;
byte[298] rsc_ini_file;
uint start_delay;
}
Arrays are variable-length in Kiwi and use the syntax byte[]
. I see now that your original question was basically about fixed-length arrays. Kiwi doesn't support fixed-length arrays. The length in variable-length arrays has very low overhead (a single byte for arrays with 127 or fewer elements) so lack of fixed-length array support wasn't an issue for me.
Sorry I am confused, I will close as not sure I am understand what this module is for.