MORE INFORMATION
Details About Method Two: Using MBF2IEEE.DLL
NOTE: These functions all do conversions between Microsoft Binary Format
(MBF) and IEEE floating point values. Some of the newer MS-DOS-based Basic
products had versions of these functions that worked differently. For
example, they let you look at an IEEE number as a string without converting
it to MBF. The routines described here are only provided as a way of
retrieving old MBF data.
These function provide conversions between IEEE floating point values and
Microsoft Binary Format (MBF) floating point values. Below is a set of
declare statements which must be included in a Visual Basic program which
will call these functions:
Declare Function Cvs Lib "MBF2IEEE.DLL" (X As String) As Single
Declare Function Cvd Lib "MBF2IEEE.DLL" (X As String) As Double
Declare Function Mks Lib "MBF2IEEE.DLL" (X As Single) As String
Declare Function Mkd Lib "MBF2IEEE.DLL" (X As Double) As String
Below is a description of each of these functions along with an example.
CVS and CVD Functions
These functions accept a 4-byte (CVS) or 8-byte (CVD) string as an
argument. They expect the bit pattern of this string to represent a single
or double precision MBF value, respectively. The function will return an
IEEE result.
Dim MBF As String, IEEE As Single
' load the string from a file, etc.
IEEE = CVS(MBF)
MKS and MKD Functions
These functions accept an IEEE single (MKS), or double (MKD) precision
value as an argument. It will then convert this value into a 4- or 8-byte
MBF value and return it in a string.
Dim MBF AS String, IEEE As Single
MBF = MKS(IEEE)
' Now write the MBF value out to disk
Potential Problems
There are differences between the IEEE format and MBF. For this reason
precision may be lost during the translations. It is also possible that
a number will not be able to be converted between the two formats. If
this is the case, a Visual Basic Overflow (Error #6) will be generated.
This is a trappable error, so handle the error accordingly.
How to Get MBF2IEEE.DLL
MBF2IEEE.EXE is a self-extracting compressed file that contains a compiled
DLL file and the source code to create a DLL file that converts Microsoft
Binary Format (MBF) data files created in early version of Quick Basic, GW-
Basic, and BASICA to the industry standard IEEE data format.
The following files are available for download from the Microsoft
Download Center:
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
After downloading MBF2IEEE.EXE, run it to obtain MBF2IEEE.DLL along with
the source files and a MBF2IEEE.TXT file, which is a readme that contains
the text of this article.
Source Code Included in MBF2IEEE.EXE
In addition to the .DLL itself, you will also find the source code, so you
can make modifications and recompile if you have Microsoft C. To recompile
and build a new .DLL file, you must use Microsoft C because the routines
are specific to Microsoft C and rely on the way Microsoft C returns
floating point Values. It will not compile with Borland C.
To recompile with Microsoft C, use the following command line statements to
build the DLL:
cl -ALw -Ow -W2 -Zp -Tp mbf2ieee.c
link /nod c:\vb\cdk\vbapi.lib mbf2ieee, mbf2ieee.dll, NUL, sdllcew
oldnames libw, mbf2ieee
rc -t mbf2ieee.dll
implib mbf2ieee.lib mbf2ieee.def