Thread: need help with gotoxy() !!!

  1. #1
    Unregistered
    Guest

    Question need help with gotoxy() !!!

    this code:
    ------------------------------------------------
    unsigned char c;
    textbackground(YELLOW);
    clrscr();
    for(c=1; c<=80; c++) putchar(BK);
    gotoxy(1, 2);
    putchar(BK);
    gotoxy(80, 2);
    putchar(BK);
    gotoxy(1, 3);
    for(c=1; c<=80; c++) putchar(BK);
    gotoxy(1, 4);
    for(c=1; c<=80; c++) putchar(LH);
    gotoxy(1, 25);
    for(c=1; c<=25; c++) putchar(LH);
    -----------------------------------------------
    (BK, LH are integer constants)
    dousnt work so well, it clears the screen then sends the cursor to the position of 80, 25 and starts printing the chars without performing gotoxy, is there something wrong with my code?

  2. #2
    Patent Pending GSLR's Avatar
    Join Date
    Sep 2001
    Posts
    134

    gotoxy

    Hi ,

    Have you used the correct header file conio.c .

    Cheers.

  3. #3
    Registered User C_Coder's Avatar
    Join Date
    Oct 2001
    Posts
    522
    gotoxy isn't ansi standard, if your using msvc then you won't have it, an alternative can be found in the FAQ

  4. #4
    Unregistered
    Guest
    im using DJGPP and it does contain a conio library that i included, it just doesnt work!

  5. #5
    Registered User C_Coder's Avatar
    Join Date
    Oct 2001
    Posts
    522
    I use msvc and it has conio.h but no gotoxy, so just because you have the header dosen't mean you have the function(as i said it isn't ansi standard).
    Use the alternative in link I posted.

  6. #6
    Unregistered
    Guest
    1) my conio.h contain gotoxy() (i checked)
    2) DJGPP doesnt seem to contain windows.h so i cant use the example...

  7. #7
    Unregistered
    Guest
    oh well, i found out by my self - putchar doesnt work with gotoxy, i used printf and it worked... i cant belive you didnt knew that, c_coder!
    anyway if you came here to help me worry not cause i have a new question here (about that annoying text cursor)
    http://www.cprogramming.com/cboard/s...threadid=11094
    (i hope urls are working under this forum...)

  8. #8
    Registered User C_Coder's Avatar
    Join Date
    Oct 2001
    Posts
    522
    putchar doesnt work with gotoxy
    I use the gotoxy in the example and putchar does work with that one, so it just goes to show how different non ansi standard functions can be implemented by different compilers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What is gotoxy??
    By Beachblue in forum C Programming
    Replies: 6
    Last Post: 11-23-2008, 01:24 AM
  2. Tic Tac Toe movement
    By $l4xklynx in forum Game Programming
    Replies: 4
    Last Post: 11-06-2008, 07:22 PM
  3. gotoxy(); help!!
    By clique in forum C Programming
    Replies: 2
    Last Post: 10-07-2008, 04:08 AM
  4. Want to see if I am using gotoxy the right way ...
    By o0obruceleeo0o in forum C++ Programming
    Replies: 5
    Last Post: 04-22-2003, 04:17 PM
  5. Is gotoxy ansi?
    By MeneLaus in forum C Programming
    Replies: 2
    Last Post: 05-18-2002, 02:48 PM