Thread: Moving the output.

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    45

    Moving the output.

    Currently, I am working on a project that involves putting the output to the very far right of the MSDOS box. Does anyone know any way that I can achieve this.

    Thanks
    Last edited by mintsmike; 03-27-2009 at 09:33 AM. Reason: The formatting was wrong

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    If it's for Windows command prompt, much of the code here: Help editing console output
    will probably help you.

    If it's actually for DOS, then you would have to do something different (depends on which compiler what you actually end up doing).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    45
    I really dont see how that is meant to help me, sorry

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by mintsmike View Post
    I really dont see how that is meant to help me, sorry
    What part of my reply is it that you do not understand?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by mintsmike View Post
    Currently, I am working on a project that involves putting the output to the very far right of the MSDOS box. Does anyone know any way that I can achieve this.

    Thanks
    Print spaces. If you have a line of length N, and a console of width W, and you want to right-justify the line, then print W-1-N spaces then print the line.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  6. #6
    Registered User
    Join Date
    Mar 2009
    Posts
    45
    I just want some sample code.

    Eg.

    cout << "blah blah";

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    cout << setw(75) << right << "Text on the right";

    something like that, you mean?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  8. #8
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by mintsmike View Post
    I just want some sample code.

    Eg.

    cout << "blah blah";
    You can't take six nanoseconds to understand what "print some spaces" entails?

    matsp's solution is more C++-ish anyway
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help for my output array
    By qwertysingh in forum C Programming
    Replies: 1
    Last Post: 02-17-2009, 03:08 PM
  2. execl()/fork() output
    By tadams in forum C Programming
    Replies: 19
    Last Post: 02-04-2009, 03:29 PM
  3. Replies: 4
    Last Post: 11-30-2005, 04:44 PM
  4. Formatting output into even columns?
    By Uncle Rico in forum C Programming
    Replies: 2
    Last Post: 08-16-2005, 05:10 PM
  5. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 05:27 AM