I am writing data to *.dat file in columns. How can I manipulate the output so every number in the first column is 6 characters wide and the second column is 5 characters wide? In C++, I used setw(6) to set the width of each output. How can I do this in C?
This didn't work.
Code:fprintf(outfile, "%03.2lf %2.2lf", data1[i], data2[i]);
I try to use strncpy to acquire the second column's data. Since the first column has different widths, based on the number, I index at the wrong position.
Basically I need to read ascii data into the program.