[EMAIL PROTECTED] wrote:
> ...
> printf("%2d",((localtime(time))[5]-100)),"\n";
> ... why don't printf() and sprintf() pad numbers with zeros
> and strings with spaces?
> Robin
Your question resembles a bit to the question about the special
degree of curvedness of some bananas.
Nevertheless (and more precisely than those bananas' curvedness)
you can control those padding blanks or zeros by inserting (or
not inserting) a null before that 2 .
This is explained in Shuck -> sprintf:
" 0 use zeros, not spaces, to right-justify"
I could not notice a difference in the padding behaviour
between printf and sprintf:
=cut
printf("%02d\n",((localtime(time))[5]-100));
print sprintf("%02d\n",((localtime(time))[5]-100));
=will yield
01
01
One more remark: Put the \n into the format part of s?printf.
regards, Detlef