## Metakit sample code - Dump

This application is a generic utility for the Metakit library.

What it does: Dump is a utility program which displays the contents of a Metakit datafile on standard output. The output shows all the information which is stored in the datafile, which can be quite useful while developing and debugging applications based on Metakit.

What it illustrates: Dump is a so-called "32-bit console application", this is the modern version of the classical MS-DOS command-line executables. It shows how you can extract structural information from a Metakit datafile without knowing anything about it. The basic trick is to simply open the file, and then to step through each of the properties (using the members NumProperties and NthProperty). The executable file is tiny, because both Metakit and MFC have been linked as DLLs.

How to use it: To dump a datafile, you can start DUMP.EXE from the MS-DOS prompt with the filename as argument (or drop a file on it in the Explorer). Since datafiles can store arbitrarily nested data structures, you may need to examine the output to understand how the information is presented on standard output. Dump adds quite a bit of detail to guide you (including all the property names). Basically, the data structure is traversed recursively, with indentation added to reflect the current nesting level. There are a number of command-line options to modify the default output style:

-s
  List all tables and subtable, but omit the actual data values.
-d
  List all tables and subtables, including a low-level data dump.
-f
  Only list all the fields (properties) and their structure.
-w
  Wait for the RETURN key just before exiting.

You can redirect the output to file, just like any other console application.

Known problems: None. Note that this is a 32-bit application which requires Windows 95 (or perhaps Windows NT or Win32s), and that the Metakit DLLs are used.

Files in EXAMPLES\DUMP:

DUMP.CPP - Dump main program
DUMP.MAK, DUMP.MDP - MSVC 4.2 project makefiles for Win32

|| Roadmap Class Index Sample Index || Introduction Tips and Tricks ||