Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - a<b> stream</b> is the name given to a file or device which has been opened for http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
A stream is the name given to a file or device which has been opened for
data transmission.  When a stream is opened, a pointer to a  FILE structure
is returned.  This pointer is used to reference the stream when other
functions are subsequently invoked.

There are two modes by which data can be transmitted:

binary
    Data is transmitted unchanged.

text
    On input, carriage-return characters are removed before following
    linefeed characters.  On output, carriage-return characters are inserted
    before linefeed characters.

These modes are required since text files are stored with the two characters
delimiting a line of text, while the C convention is for only the linefeed
character to delimit a text line.

When a program begins execution, there are a number of streams already open
for use:

stdin
    Standard Input:  input from the console

stdout
    Standard Output:  output to the console

stderr
    Standard Error:  output to the console (used for error messages)

stdaux
    Standard Auxiliary:  auxiliary port, available for use by a program

stdprn
    Standard Printer:  available for use by a program

These standard streams may be re-directed by use of the  freopen function.

See also the section File Manipulation Functions for other functions which
operate upon files.

The functions referenced in the section Operating System I/O Functions may
also be invoked (use the  fileno function to obtain the file handle).  Since
the stream functions may buffer input and output, these functions should be
used with caution to avoid unexpected results.

The following functions are defined:

clearerr
    clear end-of-file and error indicators for stream

fclose
    close stream

fcloseall
    close all open streams

fdopen
    open stream, given handle

feof
    test for end of file

ferror
    test for file error

fflush
    flush output buffer

fgetc
    get next character from file

fgetchar
    equivalent to fgetc with the argument stdin

fgetpos
    get current file position

fgets
    get a string

flushall
    flush output buffers for all streams

fopen
    open a stream

fprintf
    format output

fputc
    write a character

fputchar
    write a character to the stdout stream

fputs
    write a string

fread
    read a number of objects

freopen
    re-opens a stream

fscanf
    scan input according to format

fseek
    set current file position, relative

fsetpos
    set current file position, absolute

_fsopen
    open a shared stream

ftell
    get current file position

fwrite
    write a number of objects

getc
    read character

getchar
    get next character from stdin

gets
    get string from stdin

perror
    write error message to stderr stream

printf
    format output to stdout

putc
    write character to file

putchar
    write character to stdout

puts
    write string to stdout

rewind
    position to start of file

scanf
    scan input from stdin under format control

setbuf
    set buffer

setvbuf
    set buffering

tmpfile
    create temporary file

ungetc
    push character back on input stream

vfprintf
    same as fprintf but with variable arguments

vfscanf
    same as fscanf but with variable arguments

vprintf
    same as printf but with variable arguments

vscanf
    same as scanf but with variable arguments

See the section Directory Functions for functions which are related to
directories.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson