union REGS don´t get DOS Version

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bruno Barros

    #1

    union REGS don´t get DOS Version

    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

    #2
    Re: [OT] union REGS don´t get DOS Version

    "Bruno Barros" <bruno.malkut@g mail.com> wrote in message
    news:1139337296 .220296.104900@ f14g2000cwb.goo glegroups.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


    Comment

    • Randy Howard

      #3
      Re: union REGS don´t get DOS Version

      Bruno Barros wrote
      (in article
      <1139337296.220 296.104900@f14g 2000cwb.googleg roups.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.p rogrammer

      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





      Comment

      • Emmanuel Delahaye

        #4
        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

        Comment

        • Kenneth Brody

          #5
          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:ThisIsA SpamTrap@gmail. com>

          Comment

          Working...