Bionic Buffalo Tech Note #66: File Identification Headers
An accounting program might provide data for use by add-on or supporting applications,
such as custom depreciation or report programs. Although only the accounting program
itself would be expected to read the rest of the file, the application unstructured
information would be available to the supporting software to make choices about what
work to perform, or what to request of the accounting application. For instance, the
accounting program might put accounting period dates in the unstructured area, so a
report program would know whether the rest of the file should be examined.
A database or file access program might put activity and usage statistics in the
organization unstructured area, so other applications might know when to select the file
for compression, backup, or other activity.
A printing or rendering application might put address or mailbox information in the
owner unstructured area, so a centralized printing facility or business can route the
finished work back to the user who commissioned it.
Any application might put copyright or trade secret notices in the owner unstructured
area.
Bionic Buffale envisions a tagged structure for the unstructured areas, with certain “standard” tags.
However, that specification is not yet complete.
After the unstructured areas, there may be padding inserted before the beginning of the file contents
proper. The length of the padding will depend on the combined effect of the three alignment values in
the fixed areas.
Using the Identification Headers
The
morocco
library (see http://www.tatanka.com/prod/info/morocco.html), available free under
GPL, provides several routines for reading and writing these identification headers. They assume a
stream (
FILE *
) is already open for the file. They employ a data structure of type
mar_dataset_ident_info_T
to represent the identification header information.
mar_dataset_stream_identity_get()
returns the identity information for an
open stream.
mar_dataset_stream_identity_set()
writes an identification header to an
open stream; if passed a
NULL
stream, it simply calculates the required length of the
identification header
mar_dataset_stream_identity_release()
frees the storage (including
secondary memory) associated with a
mar_dataset_ident_info_T
structure.
Page 6 of 7