[comp.windows.ms] Problems with the MEDIUM-Model library

eeingers@cybaswan.UUCP (m t ingersoll) (06/10/90)

Hi there,
	I've been experiencing some problems with the medium-model library
in a Windows application. The most noticeable problem is floating-
point errors: e.g. sprintf(Buf, "%lf", 1.23) actually prints 0.123 into 'Buf'!
Other errors have also been noticed, for example the IO routines don't
appear to work properly. These problems automatically disappear if I use
the large-model library.

Does anybody have any ideas? I'm using C 5.1 and have rebuilt the libraries
from scratch a number of times to ensure their integrety, although this is not
doing a lot for my sanity! I have also tried using both emulator and alternate
libraries, all to no avail. I'd rather not use the large-model library since
this requires that you make the DATA segment fixed, it also appears to
cause problems when attempting to start multiple instances of the same App.

Thanks in advance, Tim.

wallwey@snoopy.Colorado.EDU (WALLWEY DEAN WILLIAM) (06/12/90)

In article <1884@cybaswan.UUCP> eeingers@cybaswan.UUCP (m t ingersoll) writes:
>
>Hi there,
>	I've been experiencing some problems with the medium-model library
>in a Windows application. The most noticeable problem is floating-
>point errors: e.g. sprintf(Buf, "%lf", 1.23) actually prints 0.123 into 'Buf'!

If I'm not mistaken you are passing a float when sprintf is expecting a
long float.  Try this:

sprintf(Buf, "%lf", (long float) 1.23);

I think this will work, but I don;t have my manual or C here!

		-Dean Wallwey