Files and their types in C

There are many types of files in C which are different like disk file, printer and terminals. A stream is associated with a file by using the file open function. After opening a file info can be exchanged by the file and the program. A file is disassociated with a stream by using a file close function. If a open file is closed, the contents of the associated stream are written to the external device. This is known as flushing the stream. This operation ensures that there is no data loss. All files are closed when a program execution is complete or by calling the exit() function. Files still remain open when a program is aborted or when abort() function is called. Each stream associated with a file has control structure of type FILE. This file control block is never modified.

Leave a Reply