This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: EME 5 Fall 2007 Discussion 9 Streams and Files The C I/O system supplies a consistent interface to the C programmer independent of the actual device being accessed. That is, the C I/O system provides a level of abstraction between the programmer and the device. This abstraction is called a stream and the actual device is called a file . In C, a file may be anything from a disk file to a keyboard/scanner or monitor/printer. In C, the term file pointer is also used to mean stream . File Pointers A statement such as FILE *fp; declares a file pointer variable fp . The data type FILE is defined in stdio.h. A FILE object holds all the internal information about the connection to the associated file, such as the file position indicator and buffering information. FILE objects are allocated and managed internally by the I/O functions. User programs should only deal with pointers to these objects (that is, FILE * ) rather than the objects themselves. The file pointers below are defined in stdio.h as standard streams for a program.standard streams for a program....
View Full Document
This note was uploaded on 04/21/2008 for the course EME 005 taught by Professor Cheng during the Fall '07 term at UC Davis.
- Fall '07