Why not have the null terminator so you can pass to normal printf?
You could even do something crazy with packing a null byte with sz on 64-bit systems (since you will never have a string that long anyway...)
You could even do something crazy with packing a null byte with sz on 64-bit systems (since you will never have a string that long anyway...)
I don't include the null-terminator because I use this type in my own environment where I never use null-terminated strings so there is no need for it.
printf("%.*s", len, str);
lets you pass the length as an int argument.