Philip Tong wrote:

> I've just started learning C. When I compile the program below, either
> with 'gcc' or 'g++' no errors were displayed and the binary file will be
> created. When I execute it, nothing will happen at all. What have I done
> wrong?
> 
> ***********************************************************
> #include <stdio.h>
> #include <string.h>
> 
> int main()
> {
> int x;
> 
> x=0;
> while (x==0)
>      {
>      x=getchar();
>      }
> 
> printf("%d = %c\n",x,x);
> 
> 
> return 0;
> }
> ************************************************************

The program will wait for getchar() to return. Unless you put the
terminal driver into raw mode, this won't happen until you press
Return.

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to