Hi,
    Why not write our own getch() function? Here you go...
char getch(void )
{
 char c;
 system("stty raw");
 c=getchar();
 system("stty cooked");
 return c;
}
Please refer man page of stty for details.


On Thu, Jul 28, 2011 at 1:12 PM, Avinash Sonawane <
[email protected]> wrote:

>
> Avinash Sonawane
> PICT Pune
> Facebook <http://www.facebook.com/avinash.sonawane1990>
> Twitter <http://www.twitter.com/SonawaneAvinash>
>
>
>
> On Thu, Jul 28, 2011 at 12:44 PM, Tavish Naruka <[email protected]>wrote:
>
>>
>> 2) Is there any similar  kind of replacement for getch() too ?
>>> 3) Why conio.h doesn't work in GCC ?
>>>
>>
>> if you are used to using getch() at the end of your programs, to create a
>> pause, then its not needed. For other uses you can use getchar(). These are
>> not a part of the standard c library libc, so you can't use conio.h.
>>
>
> All right. Actually I use getch() just to see the output. By the way when I
> used getchar() instead of getch(), program got executed but didn't show any
> output on the terminal. which simply means it didn't stop.
>
> But interestingly when I run the same code on CodeBlock IDE it showed me
> the output. Why is it so ?
>
> Program :
>
> # include <stdio.h>
> # include <stdlib.h>
>
>  void main()
> {
> system("clear");
> printf("First program using GCC");
> getchar();
> }
>
> terminal:
>
> avinash@titanic:~/Documents/C$ gcc first.c
> avinash@titanic:~/Documents/C$
>
>
>> --
>>  Tavish Naruka
>>
>>
>>  --
>> Mailing list guidelines and other related articles:
>> http://lug-iitd.org/Footer
>>
>
>  --
> Mailing list guidelines and other related articles:
> http://lug-iitd.org/Footer
>



-- 
*Regards,*
*Paul Davies C*
*vivafoss.blogspot.com
*
*Follow me on twitter <http://www.twitter.com/paulmelu>
*

-- 
Mailing list guidelines and other related articles: http://lug-iitd.org/Footer

Reply via email to