Xcode - conio.h library

Discussion in 'Mac Programming' started by ojb13004, Dec 16, 2013.

  1. ojb13004 macrumors newbie

    Nov 26, 2013
    I need to use the gotoxy function for a programming exercise I'm doing at university. This is a function found in the conio.h library. As this is not a standard library I need to be able to download and import the library ready to use. Can anyone do a walkthrough for me? I'd be very grateful, but please keep it simple, I'm not massively knowledgeable on computer jargon! Thanks!
  2. Guiyon macrumors 6502a

    Mar 19, 2008
    North Shore, MA
    conio.h is a Windows-specific library. It is not available for Mac OS X.
  3. ojb13004 thread starter macrumors newbie

    Nov 26, 2013
    Well I have managed downloaded a conio.h library to my mac. I just don't know how to implement it.
  4. chown33 macrumors 604

    Aug 9, 2009
    So many bees
    Where did you get this conio.h from? Please post the actual URL, or the URL of a page with a download link.

    A conio.h file isn't a library, it's a header file. If there isn't an implementation in some other file or files that comes with the header file, you don't have the whole thing.

    At most, a header file declares functions and variables, which will then need to be linked in from a conio library. A header is not an implementation. The implementation would need either some .c files (a source-code implementation) or a .dylib file (a shared library) or a static library (a .a file).

    Read more on conio.h in this Wikipedia article:

    Think of a header file as a promise to the compiler that there will be functions and variables with the declared names when the time comes to link the program. If the header is a promise, then the linkable library is the fulfillment of that promise. If the fulfillment is missing (the library), then the promise (header) means nothing. All you get is a bunch of broken promises (linker errors) saying that such-and-such function or variable can't be found.
  5. subsonix macrumors 68040

    Feb 2, 2008
    As have been mentioned, it's a non standard, old header file that's not really used anymore. Most likely your lab or class does not depend on this header file for anything important, i.e you will do just fine without it.

    A quick google showed an ansi escape equivalent that may work for you as a replacement, if you must use it.

    void gotoxy(int x, int y) {
        printf("\x1b[%d;%df", y, x);
    The closest thing you get on Unix or OS X is probably curses or termios, but non of them are drop in replacements by any means, they are both defined in the posix standard however.
  6. robvas macrumors 68030

    Mar 29, 2009
    Here's what you need to do - install VirtualBox (free) and install Windows XP (you could also use DOSBox). The next thing you do is download the old Turbo C compiler from Borland, they have made them free since they are so old:


    Then you can use conio.h inside that old compiler inside of DOS/Windows. There's also a version of conio.h you can use on Sourceforge that works with the free MingW compiler for Windows.
  7. ofbarea macrumors newbie

    Dec 20, 2013
    Hi, there is conio implementation for Linux and chances are that it will work on OS X.

    Take a look:

    Just keep the following coment in mind:
    "Guys, it works with a bit of tinkering around. The developer decided to celebrate 6 New Year's without us. diff a/conio.h b/conio.h 297a298 > return 0; ------------------------ forcing ncurses by putting '#include <ncurses.h>' in all files resolves all compile errors. ------------------------ compiler: g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3"

    Hope this helps.
  8. Mangesh D More, Sep 27, 2015
    Last edited by a moderator: Sep 27, 2015

    Mangesh D More macrumors newbie

    Mangesh D More

    Sep 27, 2015
    tell me procedure program having conio lib cant run fatal error occured
  9. sharon9662 macrumors newbie

    Oct 15, 2016

    In doing so the the coordinates are printed aswell

Share This Page