MT 262 - Block 2 - Unit 4 - Input, Output and Files
fellstrider.com - the logo!
Home| OU Study Rooms | MT262 Index | Block 2 - Structures
 
Input, Output and Files

Files

Files allow a program to communicate with the world outside. Such files are the virtual representation of the devices used. An input file is where the data is read from. This can be data from keyboard, scanner, camera, modem etc. An output file is the file that data will be written to. Once again there are numerous devices.

All data files have the following in common:

A file used for input is open for reading. Conversely a file used for output is open for writing. In certain circumstances it is necessary for files to be used for both actions simultaneously.

Files themselves can be a data type and as such should be included in data tables where relevant.

Type Identifier Description
Integer R Row counter read from file
Integer S Slot counter read from file
Integer InQuantity Product quantity read from file
File DataFile File of warehouse data
Data table

File error

Errors with files can arise:

There must be efforts made to ensure that files are successfully opened. This should be covered at the design stage with appropriate action specified should the file fail to open correctly.

if file opens correctly then
   do processing
else
   deal with error
Home| OU Study Rooms | MT262 Index | Block 2 - Structures
Move on to Unit 4 - C++ Files

Valid CSS! Valid XHTML 1.0!

Comments, suggestions, ideas to
Stuart Banner