Number of digits?
Excuse the newbie question but I haven't been able to find an answer to my problem. Most questions I can find on the net but I'm not sure what to search for this time.
I have a small simple program I wrote that reads the number of seconds the system has been up and outputs 3 values; days, hours and minutes. The trouble is when any value is less than 10 only 1 digit is displayed and messes my formating. What I want to do is always output 2 digits so if a value is less than 10 it starts with a zero like '08'.
Any help or pointers would be much appreciated.
printf format specifiers. Specificly, look at the 0 and the "optional decimal digit" section.
printf( "%02", 3 );
That did the trick, thank you