Variable column widths, string lengths in printf-style functions
I have been programming in C for quite some time, but until recently I was not aware that you could specify column widths and string limits using variables. I have neither seen this functionality used in any projects until I started working with OpenSER.
Specify a variable column width:
printf("%*d", width, number);
Specify a variable number of characters from a string:
printf("%.*s", width, string);
Can you please post a link
Can you please post a link to document explaining this feature
Documentation
http://linux.die.net/man/3/printf
It's described under "The field width"
http://msdn2.microsoft.com/en-us/library/25366k66.aspx
Alternative
Post new comment