Connecting Tech Pros Worldwide Help | Site Map

union REGS donīt get DOS Version

Bruno Barros
Guest
 
Posts: n/a
#1: Feb 7 '06
Hello,

I donīt know if union REGS <dos.h> is part of this group, but i have
a problem. At the moment i use turboc++lite and i donīt have reply
when i execute the question code. Only a black screen! Anyone help me?
Whatīs is wrong? This code return the DOS version.

#include <stdio.h>
#include <dos.h>
#include <conio.h> //use getch() e clrscr()

void main(void)
{
union REGS in_regs, out_regs;
in_regs.x.ax = 0x3000;

intdos(&in_regs,&out_regs);
printf("Version %d.%d\n", out_regs.x.ax & 0xFF, out_regs.x.ax[color=blue][color=green]
>>8);[/color][/color]
}

Thx
B. Barros

Mike Wahler
Guest
 
Posts: n/a
#2: Feb 7 '06

re: union REGS donīt get DOS Version


"Bruno Barros" <bruno.malkut@gmail.com> wrote in message
news:1139337296.220296.104900@f14g2000cwb.googlegr oups.com...[color=blue]
> Hello,
>
> I donīt know if union REGS <dos.h> is part of this group,[/color]

It's not part of standard C, so not topical here.
[color=blue]
> but i have
> a problem. At the moment i use turboc++lite[/color]

Try a newsgroup where that compiler is topical.
[color=blue]
> and i donīt have reply
> when i execute the question code. Only a black screen! Anyone help me?[/color]

Not here.
[color=blue]
> Whatīs is wrong? This code return the DOS version.
>
> #include <stdio.h>[/color]

This is the only part of your code which is standard.

Try a group about Turbo C, or perhaps MSDOS.

-Mike


Randy Howard
Guest
 
Posts: n/a
#3: Feb 7 '06

re: union REGS donīt get DOS Version


Bruno Barros wrote
(in article
<1139337296.220296.104900@f14g2000cwb.googlegroups .com>):
[color=blue]
> Hello,
>
> I donīt know if union REGS <dos.h> is part of this group,[/color]

It's not. What's DOS?

Seriously, we stick to ANSI standard C here, and that is
anything but standard. You probably want to look at a newsgroup
with DOS in the group name. For example,
comp.os.msdos.programmer

FWIW, nobody has cared much about the version of DOS in a decade
or more.

--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw





Emmanuel Delahaye
Guest
 
Posts: n/a
#4: Feb 7 '06

re: union REGS donīt get DOS Version


Bruno Barros a écrit :[color=blue]
> I donīt know if union REGS <dos.h> is part of this group,[/color]

It's not. It's a Borland C extension for MS-DOS defined in <dos.h>. Not
portable at all. Very specific...

<way off-topic>
[color=blue]
> but i have
> a problem. At the moment i use turboc++lite and i donīt have reply
> when i execute the question code. Only a black screen! Anyone help me?
> Whatīs is wrong? This code return the DOS version.[/color]

Do you have a DOS system ? Windows/XP is NOT a DOS system.
[color=blue]
> #include <stdio.h>
> #include <dos.h>
> #include <conio.h> //use getch() e clrscr()[/color]

Unneeded...
[color=blue]
> void main(void)[/color]

int main(void)
[color=blue]
> {
> union REGS in_regs, out_regs;
> in_regs.x.ax = 0x3000;
>
> intdos(&in_regs,&out_regs);[/color]

This only works in real mode (Pure MS-DOS) or on the Windows VM (Virtual
Machine) found on DOS/Windows (3.x, 9x etc.).

On a modern OS like NT or XP, such a call will invoke an undefined
behaviour.

What exactly is your system ?

</>

--
A+

Emmanuel Delahaye
Kenneth Brody
Guest
 
Posts: n/a
#5: Feb 7 '06

re: union REGS donīt get DOS Version


Emmanuel Delahaye wrote:
[...][color=blue][color=green]
> > but i have
> > a problem. At the moment i use turboc++lite and i donīt have reply
> > when i execute the question code. Only a black screen! Anyone help me?
> > Whatīs is wrong? This code return the DOS version.[/color]
>
> Do you have a DOS system ? Windows/XP is NOT a DOS system.[/color]

Note that XP will run 16-bit DOS executables, and emulate a 5.0 MS-DOS
system.

[...][color=blue]
> This only works in real mode (Pure MS-DOS) or on the Windows VM (Virtual
> Machine) found on DOS/Windows (3.x, 9x etc.).
>
> On a modern OS like NT or XP, such a call will invoke an undefined
> behaviour.[/color]

Actually, XP includes a DOS emulator, and the above is well-defined
when run on XP. (And NT, 2000, and 2003 as well.)

[...]

Of course, none of this makes it topical for c.l.c, so I'm wondering
why I'm posting this.

Well, it could serve as an example of why you should post in the
correct newsgroup, so you'll be more likely to get information from
people who are familiar with the platform.

--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody | www.hvcomputer.com | |
| kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:ThisIsASpamTrap@gmail.com>

Closed Thread