Thread: gotoxy problems

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

    Question gotoxy problems

    is their an easy way to center text using gotoxy mabey some way to get the size of the screen then u can calculate it from that??

    is their a way to get it to apply to more then just up to the next new line??
    cause it is annoying having to put a new one each time u do a print statment
    Parinoia Means Having All The Facts!

  2. #2
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    Posts
    533
    Code:
    #include <stdio.h>
    int main()
    {
    	printf("\t\t\t\tCentered, VOILA\n");
    	return 0;
    }
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

  3. #3
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    Posts
    533
    try this
    Code:
    #include <stdio.h> 
    #include <windows.h>
    
    void gotoxy(int x, int y);
    int main() 
    { 
    	gotoxy(28,1);
    	printf("Centered Text\n");
    	return 0;
    } 
    
    
    void gotoxy(int x, int y)
    {
       COORD coord;
       coord.X = x;
       coord.Y = y;
       SetConsoleCursorPosition(
    	   GetStdHandle(STD_OUTPUT_HANDLE), coord);
    }
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Tic Tac Toe movement
    By $l4xklynx in forum Game Programming
    Replies: 4
    Last Post: 11-06-2008, 07:22 PM
  2. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  3. String Manipulation problems -_-
    By Astra in forum C Programming
    Replies: 5
    Last Post: 12-13-2006, 05:48 PM
  4. Is gotoxy ansi?
    By MeneLaus in forum C Programming
    Replies: 2
    Last Post: 05-18-2002, 02:48 PM
  5. Multiple Problems( window(), gotoxy(), & getchar() )
    By drharv in forum C Programming
    Replies: 2
    Last Post: 02-20-2002, 09:47 PM