Copy data between stream files and database files

If you are familiar with operating on database files using record-oriented facilities such as data description specifications (DDS), you may find some fundamental differences in the way you operate on stream files.

The differences result from the different structure (or perhaps lack of structure) of stream files in comparison with database files. To access data in a stream file, you indicate a byte offset and a length. To access data in a database file, you typically define the fields to be used and the number of records to be processed.

Because you define the format and characteristics of a record-oriented file ahead of time, the operating system has knowledge of the file and can help you avoid performing operations that are not appropriate for the file format and characteristics. With stream files, the operating system has little or no knowledge of the format of the file. The application must know what the file looks like and how to operate on it properly. Stream files allow an extremely flexible programming environment, but at the cost of having little or no help from the operating system. Stream files are better suited for some programming situations; record-oriented files are better suited for other programming situations.

Related concepts
Stream file