Results 1 to 5 of 5

Thread: # include<conio.h> --- c prog

  1. #1
    Join Date
    Dec 2008
    Location
    Mars
    Beans
    265
    Distro
    Ubuntu 10.04 Lucid Lynx

    Question # include<conio.h> --- c prog

    i am getting error for this in gcc..

    i want this for
    clrscr(); and getch();
    any idea ?

    and why does gcc make me to type
    Code:
    int main() instead of void main()

  2. #2
    Join Date
    Feb 2009
    Location
    India,varanasi
    Beans
    21
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: # include<conio.h> --- c prog

    i think (not quite sure) gcc provide a facility to interact with surroundings by returning a value which is type of int .
    Edit:
    are u able to include conio.h i think it is not in gcc.
    and also u need not to use getch() or clrscr() both are useless in gcc.
    Last edited by coka; February 18th, 2009 at 05:04 PM.

  3. #3
    Join Date
    Feb 2009
    Beans
    1
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: # include<conio.h> --- c prog

    Hi Kimikrishna,

    conio.h is, if i recall correctly, a header file used in MS-DOS programming .. it's not something that you'll be able to use in Linux.

    This seemed quite helpful for implementing a getch() equivalent:

    http://cboard.cprogramming.com/archi...p/t-27714.html

    I thiiiiiiiiiiink - but it's been a while - you can either do a:

    system("clear");

    to clear the screen in a linux terminal or maybe use the curses library?:

    http://invisible-island.net/ncurses/ncurses-intro.html

    Hope this helps!
    Cheers
    kaizan

  4. #4
    Join Date
    Mar 2008
    Beans
    1,076
    Distro
    Ubuntu

    Re: # include<conio.h> --- c prog

    this function is borland specific. its way back to old turbo c++ on dos. the post above is correct and also provides a link to the standard in linux wiht the ncurses library.

    edit:
    there is a progtramming talk section here on the forums which you can ask these things. good luck .)
    Last edited by cmay; February 18th, 2009 at 05:32 PM. Reason: forgot
    please buy this online only compilation to support victims of japan. http://www.punk4japan.com/

  5. #5
    Join Date
    Nov 2008
    Location
    Lleida, Spain
    Beans
    1,148
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: # include<conio.h> --- c prog

    conio.h is not ansi-c standard

    you've to type int main() because void main() was deprecated.

    int main()
    {
    int state;
    /* your code */



    return state;
    }

    you can use ncurses
    if you speak spanish you can read this manual: http://ditec.um.es/~piernas/manpages...l-ncurses.html

    or you can browse for ncurses and C examples

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •