Thread: gotoxy(int x, int y) in Linux?

  1. #1
    Registered User MathFan's Avatar
    Join Date
    Apr 2002

    Question gotoxy(int x, int y) in Linux?

    I sat yesterday and programmed a little konsole application in Linux (just because I was bored you know ). And I found out that I couldn't use the function gotoxy(int x, int y) in Linux (though I can use it in any Borland Windows compiler). I couldn't find any header file where it's declared. Why? Doesn't Linux use this function? What other function can I use?

  2. #2
    Registered User Fredd's Avatar
    Join Date
    Oct 2002
    check out the ncurses library.

    search around or type "man ncurses" i a console.
    "Writing software is more fun than working."

    got slack?

  3. #3
    Registered User Cela's Avatar
    Join Date
    Jan 2003
    >>Why? Doesn't Linux use this function?
    Not really, gotoxy is the brainchild of Borland and pretty much is only used on Windows platforms.

    >>What other function can I use?
    It's hackey, but you can use a character print sequence to do it
    void gotoxy(int x, int y)
      printf("\033[%d;%df", y, x);
    Curses would be a better choice though :-)

  4. #4
    Registered User arastoo.s's Avatar
    Join Date
    Aug 2009
    see >> Linux: gotoxy() - c may be help u

    arastoo s

  5. #5
    Super Moderator
    Join Date
    Sep 2001
    Curses would be a better choice though :-)
    The reason for this (for the OP's benefit) is for portability. The codes that deal with this action can vary from machine to machine. Linux always emulates a VT-100 terminal, but using a Library adds another layer of safety, readability, and portability to you code. This is actually similar to the problem you had to begin with - gotoxy() is not Standard C, it just happens to be implemented by Borland compilers on Microsoft platforms. So your code wasn't portable to Linux.

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    6.5 YEAR bump!
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. memory leak
    By aruna1 in forum C++ Programming
    Replies: 3
    Last Post: 08-17-2008, 10:28 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. getting a headache
    By sreetvert83 in forum C++ Programming
    Replies: 41
    Last Post: 09-30-2005, 05:20 AM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM