On Thu, Jul 28, 2011 at 12:01 PM, Avinash Sonawane
<[email protected]> wrote:
> Sir,
> Since this is my first encounter with GCC, I am totally a newbie.
> When I tried to run the following program using GCC it gave me some errors.
>
> Program :
>
> # include <stdio.h>
> # include <conio.h>
>
> void main()
> {
> clrscr();
> printf("First program using GCC");
> getch();
> }
>
> Errors:
>
> first.c:2:20: fatal error: conio.h: No such file or directory
> compilation terminated.
>
> When I removed conio.h header file it gave me errors regarding clrscr() and
> getch() since these two functions are defined in conio.h
>
> So my questions are:
> 1) How to clear the output screen (replacement of clrscr() ) in GCC ?
system("clear"); //You Need cstdlib headder file. so do #include<cstdlib>
> 2) Is there any similar kind of replacement for getch() too ?
getchar(); // you Needs stdio.h so do #include<stdio.h>
> 3) Why conio.h doesn't work in GCC ?
>
<conio.h> is not part of the standard library. Any functions that are
prototype in that header are also non-standard.
--
Cheers,
Dhastha
Project staff
Indian Institute of Technology, Bombay
My experience on Linux: http://dhastha.wordpress.com
Member of KanchiLUG : http://www.kanchilug.wordpress.com
OAOD : http://dowithlinux.wordpress.com
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc