DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
C compilation system

Standard files

Programs automatically start off with three open files: standard input, standard output, and standard error. These files with their associated buffering are called streams, and are designated stdin, stdout, and stderr, respectively. The shell associates all three files with your terminal by default.

You can use functions and macros that deal with stdin, stdout, or stderr without having to open or close files. gets(), for example, reads a string from stdin; puts() writes a string to stdout. Other functions and macros read from or write to files in different ways: one character at a time, getc() and putc(); formatted, scanf() and printf(); and so on. You can specify that output be directed to stderr by using a function such as fprintf(). fprintf() works the same way as printf() except that it delivers its formatted output to a named stream, such as stderr.


Next topic: Named files
Previous topic: Standard I/O

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003