I want to list file in two or three columns ? just like what UNIX does (ls)
I've tried to use TAB, but failed.
Please help
I want to list file in two or three columns ? just like what UNIX does (ls)
I've tried to use TAB, but failed.
Please help
You have to see what is the biggest length of a filename in each column and then add enough spaces to make every name that long. Be sure that you know how many columns will fit before printing.
How about two column, and the filename is fit ?You have to see what is the biggest length of a filename in each column and then add enough spaces to make every name that long. Be sure that you know how many columns will fit before printing.
My code ? just add a \t when i is even in "for"
but some filename is too short, for example IO.sys, then the filename in the same line(the next file) will move to left.
If this is the only problem, then you only need to check if the filename is longer that the length of the tab and remove tabs according to that.but some filename is too short, for example IO.sys, then the filename in the same line(the next file) will move to left.
...
But what if the filenames are too long?
Thanks your opinion!Originally posted by raimo
If this is the only problem, then you only need to check if the filename is longer that the length of the tab and remove tabs according to that.
...
But what if the filenames are too long?