2 Replies Latest reply: Sep 25, 2010 11:45 AM by etresoft
Joseph Booth Level 1 (5 points)
I'm converting a C++ terminal application from VS to xCode. The code executes perfectly; however, the formatting that was specified in VS is being rendered incorrectly in xCode.

Do the setprecision and setw() format manipulators get handled differently?

Example VS:

Text 5 15 More Text

Example xCode:

Text . 5 ... 15 ...... More Text

Notice that the columns being displayed are aligning at different intervals.

I'm just a bit confused as to why my spacing would be rendered differently. Maybe it's something to do with rendering the code in a Unix terminal vs. the "DOS" terminal?

Thanks for any information you can provide.


Joseph Booth

Message was edited by: Joseph Booth

//added periods to force separation of columns to show alignment difference.

Mac G5 2 GHz 500GB 3 GB RAM, Mac OS X (10.4.11)
  • Jongware Level 2 (265 points)
    Are you using tab characters to space out the results?

    If so:
    "Tab distance" is a fluid concept -- on some systems, the default is 4 characters, on others it's 6 or 8. On some systems, the tab distance is fixed and will always insert a fixed number of space. On others, the correct position is calculated. Some text editors allow the user to change the tab distance.

    It would seem Windows' console uses another definition than Terminal does. Nothing you can do about that, except not using tabs at all.
  • etresoft Level 7 (27,801 points)
    Joseph Booth wrote:
    Do the setprecision and setw() format manipulators get handled differently?

    Not as far as I know. Could you post a small example program that demonstrates the issue?