Article 54ZYN [SOLVED] printf formatting for doubles

[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?latest?d=yIl2AUoC8zA latest?i=silpD7lyqNk:T9qegZmbFxE:F7zBnMy latest?i=silpD7lyqNk:T9qegZmbFxE:V_sGLiP latest?d=qj6IDK7rITs latest?i=silpD7lyqNk:T9qegZmbFxE:gIN9vFwsilpD7lyqNk
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments