Previous: 13.4 Operating System Interface
Up: 13 Files and the Operating System
Next: 13.6 Problems
Previous Page: 13.4 Operating System Interface
Next Page: 13.6 Problems
In this chapter we have looked at alternate file I/O functions, fread() and fwrite() which perform block I/O; transferring blocks of data directly between memory and data files. This form of I/O is more efficient than formatted I/O which converts information between its internal binary representation and the corresponding ASCII representation of the information as strings for the actual I/O. It should be remembered that files used for block I/O have information stored in binary and are therefore NOT readable by other programs which do not know the format of the data.
We also saw library routines for controlling the ``current position'' in the file stream for I/O; namely ftell() and fseek(). These operations can be performed on either text or binary files.
Finally, we discussed the interactions a program can perform with its environment - the operating system or shell. These include receiving information from the shell in the form of command line arguments which are passed to main() as arguments, and the system() function which can call on the environment to perform some command.