The
Microsearch File Format Tools module is a Windows 32-bit DLL (MSTextFileFmt.dll)
that provides utilities for handling formatted text file input and
output.
A formatted text file is a text file in which each line of text is a
specially formatted "record" containing one or more "field"s of
data.
A field in a text record may be one
of the following types (see the MSTextFileFmt.h header file for the
definitions of the field type constants):
|
Field Type |
Description |
|
MTFSTRING |
A field containing text data. For example, a person's name, or
a file name. |
|
MTFINTEGER |
An integer (whole number) containing only numeric digits. For
example, a person's age in years. |
|
MTFDOUBLE |
A floating point double precision number. For example, a
person's annual salary. |
|
MTFIDENT |
A record identifier field. This is the same as a MTFSTRING
field except that it has a special meaning for formats
containing more than one record format specification, in which
case this field uniquely identifies the record. |
The Microsearch File Format Tools can handle records that are in
one of the following general formats:
|
Record Format |
Description |
|
Delimited |
Fields in the records are delimited by a specified delimiter
character. |
|
Fixed |
Fields locations and widths are all separately specified. |
|
Free |
Fields are in free-format, i.e. they are delimited by spaces
and/or tabs. |
The tools provided in this DLL are all you need to construct file
formats, and then to use them for reading (and interpreting) and
writing text files in virtually any format.
To
use the Microsearch File Format Tools, you only need to call the
functions exported by the MSTextFileFmt.dll. The first function call
you must make is to the MTFGetHandle function as follows (note that
you must include the supplied header file "MSTextFileFmt.h" in your
code):
…
MTF_HANDLE handle = MTFGetHandle();
if ( 0 != handle )
… the handle was successfully retrieved.
After you have a valid handle, you can use it in other function
calls. The last function call you should make is to the
MTFReleaseHandle function to release resources allocated when you
created the handle:
…
if ( MTFReleaseHandle(handle) )
… the handle was successfully released.
Between the above two function calls, you can call any of the other
functions. For example, to show the Microsearch File Format Editor
dialog, you would make the following call:
…
char formatfile[MAX_PATH];
*formatfile = 0;
if ( MTFShowTextFileFormatDlg(handle, parent, formatfile ) )
… the format editor dialog was displayed successfully.
For information on using the other functions exported by this DLL,
please see the reference section.
Redistributable Files
All files supplied in the Microsearch File Format Tools package may
be redistributed. The files in the package are as follows:
|
File |
Description |
|
MSTextFileFmt.dll |
The 32-bit Windows dynamic link library of exported functions. |
|
MSTextFileFmt.h |
The header file that declares all the exported functions and
data types used by the package. |
|
MSTextFileFmt.lib |
The Borland-format static link library for the
MSTextFileFmt.dll. |
|
Help Files |
All help files are in the
TFEHelp folder.
|
|