equivalent MKSMBF$ function, Possible? 
Author Message
 equivalent MKSMBF$ function, Possible?

Hi,   Does anyone knows how to write a similar function equivalent
to the Qbasic function as shown below.
   1. MKSMBF$
   2. MKDMBF$
   3. CVSMBF$
   4. CVDMBF$

Can someone help me or show me how to decode the numbers converted
by the above Qbasic (from DOS 6) functions, using C or Pascal.
Below is a Qbasic example showing the usage of the function.
THANKS in advance.
--------------------------------------------------------
TYPE Buffer
    SngNum AS STRING * 4
    DblNum AS STRING * 8
END TYPE
DIM RecBuffer AS Buffer
OPEN "TEST.DAT" FOR RANDOM AS #1 LEN = 12
SNum = 98.9
DNum = 645.3235622#
RecBuffer.SngNum = MKSMBF$(SNum)
RecBuffer.DblNum = MKDMBF$(DNum)
PUT #1, 1, RecBuffer
GET #1, 1, RecBuffer
CLOSE #1
PRINT CVSMBF(RecBuffer.SngNum), CVDMBF(RecBuffer.DblNum)
--------------------------------------------------------

Mr Teo Teck Hong



Sat, 14 Nov 1998 03:00:00 GMT  
 equivalent MKSMBF$ function, Possible?

: Hi,   Does anyone knows how to write a similar function equivalent
: to the Qbasic function as shown below.
:    1. MKSMBF$
:    2. MKDMBF$
:    3. CVSMBF$
:    4. CVDMBF$

Without a definition, it is hard to be sure, but for number->string,
you can use sprintf in C
        char b[50];
        sprintf(b,"%g",(float)x);
        sprintf(b,"%d",(int)x);
and from strings to numbers you can use sscanf or various strto...
        float x = strtod((char*)b);
        int i = strtol((char*)b,0,0);

--

to claim his strength with claw and tooth. |          Cupertino, California
She wants to rise, to wend from lies,      | (xxx)xxx-xxxx            95015
and meet again the morning's truth.        |         I don't use no smileys



Mon, 23 Nov 1998 03:00:00 GMT  
 equivalent MKSMBF$ function, Possible?

[comp.lang.c removed from newsgroups and follow-ups, since this is a
platform-specific question, and you know how they feel about those.]


Quote:
> Hi,   Does anyone knows how to write a similar function equivalent
> to the Qbasic function as shown below.
>    1. MKSMBF$
>    2. MKDMBF$
>    3. CVSMBF$
>    4. CVDMBF$

> Can someone help me or show me how to decode the numbers converted
> by the above Qbasic (from DOS 6) functions, using C or Pascal.

Microsoft's C compilers include equivalent functions that convert between
Microsoft Binary and IEEE floating-point formats.  They are:

MKSMBF = _fmsbintoieee()
MKDMBF = _dmsbintoieee()
CVSMBF$ = _fieeetomsbin()
CVDMBF$ = _dieeetomsbin()

Borland compilers don't include these functions in their standard runtime
libraries, but you can obtain C code to implement them from Borland's ftp
site (although there's a minor bug in Borland's version of
fmsbintoieee().)

Try:

ftp://ftp.borland.com/pub/techinfo/techdocs/language/c++/bcpp/gen/msb...

The C code should convert to Pascal relatively easily.

---
Glen Blankenship




Mon, 23 Nov 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Graphics control with point() equivalent function and replace color functions

2. CVSMBF / MKSMBF$

3. Converting a Long FIleName to it's short equivalent (Both possible shorts)

4. Italian VBA function equivalents?

5. Equivalent of PointsToScreenPixelsX function in Office 97?

6. VB6 String$ function equivalent

7. Equivalent of function GetObject for .NET objects

8. API function equivalents in .NET

9. Whatz Equivalent to Shell() Function ??

10. BASIC equivalents of FP_SEG() and FP_OFF() C Functions

11. KERNAL32.DLL Equivalent Function?

12. Equivalent to Perl Split function

 

 
Powered by phpBB® Forum Software