Rather new to Odin, coming back after a while. I just got something strange (at least to me!) with the width flag of fmt format(s).
The project is a CLI filter reading a text file with a bunch of data and converting it into Odin sources to insert into another project.
With the statement:
text = fmt.bprintf(buffer[:], "{{\"%s\", %2d, %3i}}", a_string, an_int, another_int);
_ = os.write_string(output, text) or_return;
with two format fields with width (%2d and %3i, without 0 padding flag) I expect to find in the text variable the text:
{"string", 1, 0}
WITHOUT 0 padding, instead I get
{"string", 01, 000}
WITH 0 padding.
I also tried the statement:
if (fmt.fprintf(output, "{{\"%s\", %2d, %3i}}", a_string, an_int, another_int) == 0)
{ return io.Error.Short_Write }
and I get the same exact strings.
It seems the with flag for integers automatically turns 0 padding on.
Is this expected? Is it possible to have a width WITHOUT 0 padding? Thanks!
(Note: using d for one format and i for the other is just a test to see if it makes any difference: it does not).