Center Text

This is a discussion on Center Text within the C Programming forums, part of the General Programming Boards category; Is there anyway I can 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,789
    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
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    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, 04: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21