GETCHAR(III)                 4/7/73                  GETCHAR(III)







NAME

     getchar - read character



SYNOPSIS

     getchar( )



DESCRIPTION

     Getchar provides the simplest means  of  reading  characters

     from   the  standard  input  for  C  programs.   It  returns

     successive characters until  end-of-file,  when  it  returns

     ``\0''.



     Associated with this routine is an external variable  called

     fin,  which  is  a  structure  containing  a  buffer such as

     described under getc (III).



     Normally input via getchar is unbuffered, but if  the  file-

     descriptor  (first)  word  of fin is non-zero, getchar calls

     getc with fin as argument.  This means that



             fin = open(...)



     makes getchar return (buffered) input from the opened  file;

     also



             fin = dup(0);



     causes the standard input to be buffered.



     Generally speaking, getchar should  be  used  only  for  the

     simplest   applications;  getc  is  better  when  there  are

     multiple input files.



SEE ALSO

     getc (III)



DIAGNOSTICS

     Null character returned on EOF or error.



BUGS

     -1  should  be  returned  on  EOF;  null  is  a   legitimate

     character.