Slide 1.5: Guidelines of programming exercises
Slide 1.7: Files versus databases
Home

Why This Course


File Processing
File processing is the action of using file related operations (such as create, store, or retrieve) to the data in persistent storage, in a way that the data retrieved is used by a program. The data in persistent storage such as disks is saved even after the computer has been turned off and restarted.

An Example
Computer memory is limited. When the data size is large enough, the applications need the secondary storage such as hard disks to store the data. For example, the following program is compiled and executes successfully:

  Array Size Is Fine.                  
 #include  <iostream>
   using namespace std;
 int  main( ) {
   const   long  arraySize = 10000;
   double  array[arraySize];
   array[arraySize-1] = 10.0;
   cout << "The array size is fine.";
 }

The Problem
If the computer memory is not able to contain all the data, then the traditional data structures can not be used because they assume all data is in the memory. The following program does not pass the compilation because of not enough memory and data is lost after power is off even if it does:

  Array Size Is too Large.                  
 #include  <iostream>
   using namespace std;
 int  main( ) {
   const   long  arraySize = 1000000000;
   double  array[arraySize];
   array[arraySize-1] = 10.0;
   cout << "The array size is fine.";
 }