[SOLVED] printf formatting for doubles
by bkelly from LinuxQuestions.org on (#54ZYN)
Centos, c++
Please accomodate typos as I cannot copy from my computer to here and am quite subject to little errors.
This write statement typifies the writes to a file:
Code:fprintf( multi_column_file, %03.3f, %03.3f, %03.3f", a, b, c);All numbers are less than 100.0 but the columns are not lined up. %4d seems to work fine with integers, but this does not work with doubles.
What needs to be done differently?


Please accomodate typos as I cannot copy from my computer to here and am quite subject to little errors.
This write statement typifies the writes to a file:
Code:fprintf( multi_column_file, %03.3f, %03.3f, %03.3f", a, b, c);All numbers are less than 100.0 but the columns are not lined up. %4d seems to work fine with integers, but this does not work with doubles.
What needs to be done differently?