Hello Pirmin,
If I try to format some data in a anligned string with Genode::snprintf(), the data is stored in the string, but my additional format specifier for the field width aren't respected.
My string is:
static const char* lineFormat = "%5d "%25s" "%25s" %10s %5d\r\n"
Genode's format-string functions are limited to the few use cases present in the base framework. I.e., it is sufficient for simple tasks like printing a number or concatenating strings but it is not meant as a full-fledged POSIX compliant formatting utility. If you need a complete format-string implementation, I recommend you to use the libc instead.
If I do want to right align the numbers (%-5d) the function crashes my program.
This should not happen. Thank you for reporting. I just opened an issue about it:
https://github.com/genodelabs/genode/issues/1485
The comment on the functoin doesn't specify that format sizes arn't supported.
I keep a note to cover this information in the upcoming documentation. For now, please let me refer you to the implementation. I think the code is pretty self-explanatory. If not, please don't hesitate to ask.
https://github.com/genodelabs/genode/blob/master/repos/base/src/base/console...
Best regards Norman