Friday, November 4, 2011

Summary of Input/Output in C programming language

Summary

(a) File I/O can be performed on a character by character basis, a line by line basis, a record by record basis or a chunk by chunk basis.
(b) Different operations that can be performed on a file are—creation of a new file, opening an existing file, reading from a file, writing to a file, moving to a specific location in a file (seeking) and closing a file.
(c) File I/O is done using a buffer to improve the efficiency.
(d)
A file can be a text file or a binary file depending upon its contents.
(e) Library functions convert \n to \r\n or vice versa while writing/reading to/from a file.
(f) Many library functions convert a number to a numeric string before writing it to a file, thereby using more space on disk. This can be avoided using functions fread( ) and fwrite( ).
(g) In low level file I/O we can do the buffer management ourselves.

No comments:

Post a Comment