----- Original Message ----- 
 From: "Marshall Fisher" 
 To: 
 Sent: Monday, April 26, 2004 3:23 AM
 Subject: [c-prog] Input from other than file or keyboard
 
> 
> Hello all,
> 
> I'm new to C and learning as I go.  What statements in C are available to
> enable input from other than keyboard or file?
> 
> Thanks,
> Marshall
> 

    You want to ask "What functions ... ?", and not "What statements ... ?" 
Section 3.1, Statements and Blocks, of K&R says:

            "An expression such as x = 0 or i++ or printf(...) becomes a
        statement when it is followed by a semicolon, as in 

            x = 0;
            i++;
            printf(...);

        In C, the semicolon is a statement terminator, rather ..."

    As for you question, the Standard does not mention which devices should
be supported and not.  In fact, C uses a concept knowns as "Streams", borrowed
from UNIX.  Input or output from/to any *kind* of device is mapped into logical
data streams.  Streams have well defined and uniform properties, whereas devices
may not have uniformity.  There are two forms of streams defined by the
Standard: text and binary streams.

    Following points can be noted:
   
    *   A stream is connected to a file or device by opening it; the connection
            is broken by closing the stream. 

    *   The library supports text and binary streams.

    For example, UNIX and UNIX-flavoured OSes treat every device as a file;
sockets, devices and disk files can be opened, closed, etc., by 
functions.  This is possible because the library maps the I/O from/to source or
destination to streams understood by C.  Portability, you know, after all!

    Source: geocities.com/vijoeyz/faq/c

               ( geocities.com/vijoeyz/faq)                   ( geocities.com/vijoeyz)