Thread: Center Text

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    59

    Question Center Text

    Is there anyway I can center text?

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    On a console???? to the screen??????on a printout????? on a window?????

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    59

    dos window

    In a DOS window run in windows or just DOS.

  4. #4
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669

    Thumbs up

    Yes there is a way. You have to use library "conio.h" and function "gotoxy".
    Definition of function "gotoxy": void gotoxy(int x, int y);
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

  5. #5
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Code:
    int textlen=strlen(text);
    int textwidth=textlen>>1;
    int printcolumn=(MaxColumns>>1)-textwidth;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Text adventure engine idea. thoughts?
    By suzakugaiden in forum Game Programming
    Replies: 16
    Last Post: 01-15-2006, 05:13 AM
  2. Appending text to an edit control
    By dit6a9 in forum Windows Programming
    Replies: 3
    Last Post: 08-13-2004, 09:52 PM
  3. Text positioning and Text scrolling
    By RealityFusion in forum C++ Programming
    Replies: 3
    Last Post: 08-13-2004, 12:35 AM
  4. Scrolling The Text
    By GaPe in forum C Programming
    Replies: 3
    Last Post: 07-14-2002, 04:33 PM
  5. Replies: 1
    Last Post: 07-13-2002, 05:45 PM