Thread: Aligning Columns

  1. #1
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218

    Aligning Columns

    To create columns I use tab spacing in my printf's. When text in a column varies more than a little in length the alignment gets screwed up. Is there a simple way to fix this?

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    check out the width sub-specifier

    http://www.cplusplus.com/reference/c...io/printf.html

    edit: I am also a little confused now that I think about it.
    Last edited by robwhit; 06-27-2007 at 08:21 AM.

  3. #3
    Registered User OnionKnight's Avatar
    Join Date
    Jan 2005
    Posts
    555
    Is this output-related or what you see in the source code? I don't really know what you mean.

  4. #4
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    check out the width sub-specifier
    Oh cool, thats easy. I guess I should have read a bit about printf. There is quite a bit more you can do with it than I thought.

    Is this output-related or what you see in the source code? I don't really know what you mean.
    Yeah its output related. Just the way the text was aligning when being printed in the console window.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Output Columns form a file
    By Cdrwolfe in forum Tech Board
    Replies: 2
    Last Post: 03-22-2006, 05:12 AM
  2. Formatting output into even columns?
    By Uncle Rico in forum C Programming
    Replies: 2
    Last Post: 08-16-2005, 05:10 PM
  3. Program that prints numbers in columns
    By rayrayj52 in forum C++ Programming
    Replies: 12
    Last Post: 09-20-2004, 02:43 PM
  4. reading a columns input data file
    By vk13wp in forum C Programming
    Replies: 6
    Last Post: 04-28-2003, 01:32 PM
  5. Number of columns in ListControl
    By MPSoutine in forum Windows Programming
    Replies: 3
    Last Post: 03-28-2003, 02:29 PM