Thread: gotoxy

  1. #1
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804

    gotoxy

    Halo all,
    I was just using a simple example of gotoxy function.
    Code:
    #include <stdio.h>
    #include <conio.h>
    int main(void)
    {
    printf("Here\n");
    gotoxy(35,12);
    printf("There\n");
    }
    But getting errors and warning as this.
    Code:
    Warning	1	warning C4013: 'gotoxy' undefined; assuming extern returning int	
    Error	2	error LNK2019: unresolved external symbol _gotoxy referenced in function _main
    Error	3	fatal error LNK1120: 1 unresolved externals
    When I right clicked gotoxy and chose "Go to definition", I get this message
    The symbol "gotoxy" is not defined.
    What's wrong with it? Somebody please help.
    Thanks
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  2. #2
    Registered User
    Join Date
    Mar 2003
    Location
    UK
    Posts
    170
    It looks like you may have write the gotoxy() function your self.

    Look up SetConsoleCursorPosition(), if in Windows...

  3. #3
    Registered User
    Join Date
    Jun 2009
    Location
    US of A
    Posts
    305
    I hope this would be helpful

    gotoxy() is not a standard function. From one of the FAQ's on THIS WEBSITE you can find:

    Quote:
    Q. No, really - I just want to do gotoxy!!!
    A. Sigh...


    [insert]
    Code:
    #include <windows.h>
    
    void gotoxy(int x, int y)
    {
    COORD coord;
    coord.X = x;
    coord.Y = y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_H ANDLE), coord);
    }

  4. #4
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Ok. After going through the FAQ, now I get to know why gotoxy doesn't work in MSVS but works perfectly fine with TC(non-standard). Thanks all of you.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Do NOT use TC. It fails to be standard compliant.
    Just use SetConsoleCursorPosition.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

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. gotoxy(); help!!
    By clique in forum C Programming
    Replies: 2
    Last Post: 10-07-2008, 04:08 AM
  3. 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
  4. Is gotoxy ansi?
    By MeneLaus in forum C Programming
    Replies: 2
    Last Post: 05-18-2002, 02:48 PM
  5. is gotoxy a part of ANSI C 89 standard
    By kendals in forum C Programming
    Replies: 1
    Last Post: 03-20-2002, 07:43 PM