Mail Archives: djgpp/2000/04/06/22:05:39
[There is bad line wrapping in the C++ style comment I cite]
pwillard AT mindspring DOT com (pwillard) wrote:
>#include <sys\farptr.h>
>#include <go32.h>
>
>int main (void)
> {
> long int x;
I would suggest, to make x an unsigned long.
>
> // Ok, the formula for accessing DOS memory using
>the_go32_conventional_mem_selector()
> // command is segment * 16 + offset, so we need to access 0x40 * 0x10
>+0x6c
> // This assumes the first argument in PTR in pascal is segment and
>thelatter offset.
>
> x = _farpeekl(_go32_conventional_mem_selector(), 0x40 * 0x10 + 0x6C);
>
> printf("The BIOS tick count is %d.", x);
The %d is wrong for long int. Use %ld instead (or %lu if you make
x unsigned long). Yes, I do know, that %d will work with DJGPP, but
more by accident, than by design.
> }
-- Regards, Dieter
- Raw text -