Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

regs error

Status
Not open for further replies.

Mikiemike

Programmer
Joined
Jun 25, 2003
Messages
1
Location
NL
Hi guys,
Sorry to bother you with a mayve stupid question but it's really pissing me off for a couple of hours. I justed started c programming so i'm not yet fimiliar with all the in and outs.

I wrote this little program but my compiler pop-ups with a error message over and over again and I don't know how to solve it.

The message tells me:
Undefined structure 'REGS'
size of 'regs' is unkown or zero

and this is the source code:
{
union REGS regs;

regs.h.ah=0x06;
regs.h.al=0x00;
regs.h.bh=0x07;
regs.h.ch=0x00;
regs.h.cl=0x00;
regs.h.dh=ROWS-1;
regs.h.dl=COLS-1;
int86(VIDEO,&regs,&regs);
}
I Includes stdio.h and dos.h and I'm using Borland 5.1
Hope somebody can help me
VBR MIKE
 
I believe UNION regs has been deprecated in Borland compilers. Regardless, as far as I know, interrupts won't work in a Win32 application, anyway.
 
What about if you're using Dev C and you're writing a console application?

Code:
// Local variables.
    union REGS dRegs;                   // assembly date registers union
    union REGS mRegs;                   // assembly mark date registers union
    union REGS tRegs;                   // assembly time registers union
        
    unsigned int year;                  // current year
    unsigned char day;                  // current day
    unsigned char hours;                // current hour
    unsigned char leapYears;            // leap years additive
    unsigned char minutes;              // current minute
    unsigned char month;                // current month
    unsigned char seconds;              // current second

// Get the current date and time.

    mRegs.h.ah = 0x2A;                  // function to get the system date
    intdos(&mRegs,&mRegs);              // get the system date

    tRegs.h.ah = 0x2C;                  // function to get the system time
    intdos(&tRegs,&tRegs);              // get the system time

    dRegs.h.ah = 0x2A;                  // function to get the system date
    intdos(&dRegs,&dRegs);              // get the system date

    if (mRegs.h.dl != dRegs.h.dl) {     // check for a change of day
        tRegs.h.ah = 0x2C;              // function to get the system time
        intdos(&tRegs,&tRegs);          // get the system time
    }

    year = dRegs.x.cx;                  // get the current year
    month = dRegs.h.dh;                 // get the current month
    day = dRegs.h.dl;                   // get the current day

    hours = tRegs.h.ch;                 // get the current hour
    minutes = tRegs.h.cl;               // get the current minute
    seconds = tRegs.h.dh;               // get the current second
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top