08-08-2012 10:58 AM
I am writing values of variables to a text file. I also have column headings. Some of the column headings are long, perhaps 14 characters. The field for my variable values is only 8 characters long. Thus I would like to install a tab or two between my column headings so that they line up w my values. How may I do that?
08-08-2012 11:01 AM
Wouldn't you want to put the extra tabs in the data since the data is shorter than the header?
How are you currently saving the file? Care to share some code?
08-08-2012 01:15 PM
You can specify a length with the format string.
So, if the longest string is 14 characters, specify %14s as the format string. Your text will be right justified. If you want the text to appear at the left, use a format specifier of %-14s.
Don't play around with multiple TABs, it will make the file difficult to read in other apps like Excel.