Thread: Problem with 'union REGS in, out;'

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    26

    Exclamation Problem with 'union REGS in, out;'

    To put it simply the way that I stumbled on this problem is that I wanted to use vesa vba to creat my own user interface for my programs, plus I wanted to just test the capabilities of c++. The only problem is that none of the tutorals, sample code, or documentation will work. Most of the tutorals and source code contained the following line of code, that is preventing the code from compiling on my computer.
    Code:
    union REGS in, out;
    From what I have read and learned from msdn and my c++ course, I have come to think that 'REGS' is some sort of data type, probably dealing with the system regesters, and it is not defined in my version of c++. I went and searched msdn and found a few referance to 'union REGS ???, ???;' one of these referance had the following code atached to it, which also failed to compile.
    Code:
    #include <stdio.h>
    #include <dos.h>
    union REGS reg;
    
    void scroll_line()
    
    {
    
    
     /* The registers have the same significance as those in  *
     *  the assembly-language routine above.                 */ 
    
      reg.h.ah = 6;      // function 6H
      reg.h.al = 1;      // number of lines to scroll
      reg.h.bh = 0x7;    // attribute of line
      reg.h.ch = 0;      // row of top left corner
      reg.h.cl = 0;      // column of top left corner
      reg.h.dh = 24;     // row of bottom right corner
      reg.h.dl = 79;     // row of top right corner
    
      int86(0x10, &reg, &reg);
      return;
    }
    Does any one know of a way to solve this, maybe some sort of a header file that contains declarations for 'REGS', or something like that. Or in the least an explanation of why I am having problems whith the code. Just to make completly sure that no one can say that they have no way of knowing what complier I am using, I will state it now. It is MSVC++ 6.0 Profesional Edition.

    -JLBShecky // row of top right corner
    System
    OS - Microsoft Windows XP Pro
    CPU - AMD Athlon XP 2600+
    Mother Board - Abit KV7
    RAM - 512 Mb DDR (333)

    C++
    Microsoft Visual Studio Pro. 6.0
    MSDN July 2001

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    You need a dos compiler. You are using a windows compiler.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    26
    Stoned_coder, you said that the reason that I am having the problem with my complier when I use 'union REGS in, out;' is because MSVC++ 6.0 Pro. does not support actual dos. If I understand you correctly.

    One thing that I know about MSVC++ 6.0 Pro is that when is creating a workspace there is a place to select the platform to which the program is compiled (or at least that is the way that I interpate it), the only thing is that there is only one check box "Win32". Does anyone know if it is possible to get more platforms in msvc++, and if so do they have any leads other than using search engine? Or should I not take my time and just use another compiler?

    -JLBShecky

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    The sample code you have is written for DJGPP or old DOS Borland compilers.

    DJGPP is still available if you really want to use it. I think it's
    www.delorie.org or something like that.

    VC++ doesn't support any platforms other than Win32 as it is. I think there is a version that supports WinNT on Alpha, and the newest version might support Win64.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  2. "generic" union or something
    By Raven Arkadon in forum C++ Programming
    Replies: 2
    Last Post: 12-05-2005, 09:55 PM
  3. Replies: 5
    Last Post: 11-07-2005, 11:34 PM
  4. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM
  5. binary tree problem - help needed
    By sanju in forum C Programming
    Replies: 4
    Last Post: 10-16-2002, 05:18 AM