neonep
Programmer
- Jun 26, 2003
- 34
int num = 32;
fprintf ( file, "%6d", num ); writes " 32" into the file
fprintf ( file, "%06d", num ); writes "000032" into the file
How can I use similar padding to put 0's before digits of a double?
So if I have
double d = 32.5;
fprintf ( file, "%4.2f", d ); yields " 32.5"
I want it to be "0032.5"
Any help will be appreciated. Thanks.
fprintf ( file, "%6d", num ); writes " 32" into the file
fprintf ( file, "%06d", num ); writes "000032" into the file
How can I use similar padding to put 0's before digits of a double?
So if I have
double d = 32.5;
fprintf ( file, "%4.2f", d ); yields " 32.5"
I want it to be "0032.5"
Any help will be appreciated. Thanks.