- Nov 22, 1999
- 1,000
- 4
- 81
I am trying to make a clear screen function and another function to home the cursor. So once I wrote out the code I get 25 errors and I don't know why. Here are the errors I get:
--------------------Configuration: Cpp2 - Win32 Debug--------------------
Compiling...
Cpp2.cpp
E:\C-Files\Homework\CLS\Cpp2.cpp(15) : error C2079: 'regs' uses undefined union 'REGS'
E:\C-Files\Homework\CLS\Cpp2.cpp(18) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(18) : error C2228: left of '.ah' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(19) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(19) : error C2228: left of '.al' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(20) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(20) : error C2228: left of '.bh' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(21) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(21) : error C2228: left of '.ch' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(22) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(22) : error C2228: left of '.cl' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(23) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(23) : error C2228: left of '.dh' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(24) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(24) : error C2228: left of '.dl' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(25) : error C2065: 'int86' : undeclared identifier
E:\C-Files\Homework\CLS\Cpp2.cpp(37) : error C2079: 'regs' uses undefined union 'REGS'
E:\C-Files\Homework\CLS\Cpp2.cpp(40) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(40) : error C2228: left of '.ah' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(41) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(41) : error C2228: left of '.bh' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(42) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(42) : error C2228: left of '.dh' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(43) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(43) : error C2228: left of '.dl' must have class/struct/union type
Error executing cl.exe.
Cpp2.obj - 25 error(s), 0 warning(s)
And this is the C++ code:
#include<stdio.h>
#include<dos.h>
#include<conio.h>
#include<stdlib.h>
#define VIDEO 0x10 //Video Interrupt
#define COLS 80 //Screen Width
#define ROWS 25 //Screen Rows
void cls(void);
void locate(int col, int row);
void cls(void)
{
union REGS regs;
regs. h . ah=0x06; //func 6, scroll window
regs. h . al=0x00; //clear screen
regs. h . bh=0x07; //make screen "blank"
regs. h . ch=0x00; //Upper left row
regs. h . cl=0x00; //Upper left column
regs. h . dh=ROWS - 1; //Lower right row
regs. h . dl=COLS - 1; //Lower right column
int86(VIDEO,&regs,&regs);
locate(0,0); //"Home" the cursor
}
/* LOCATE Function
Moves the cursor to position col,row, where col ranges from 0 to 79 and row from
0 to 24. Upper left corner = 0,0; lower right corner = 79,24
*/
void locate(int col, int row)
{
union REGS regs;
regs. h . ah=0x02; //Vid func 2, move cursor
regs. h . bh=0x00; //Video screen (always 0)
regs. h . dh=row; //Cursor's row position
regs. h . dl=col; //Cursor's column position
int86(VIDEO,&regs,&regs);
}
I have to hand this in by tommorow
. I would really appreciate any help you can give me.
Thanks,
Viper-Frag
--------------------Configuration: Cpp2 - Win32 Debug--------------------
Compiling...
Cpp2.cpp
E:\C-Files\Homework\CLS\Cpp2.cpp(15) : error C2079: 'regs' uses undefined union 'REGS'
E:\C-Files\Homework\CLS\Cpp2.cpp(18) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(18) : error C2228: left of '.ah' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(19) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(19) : error C2228: left of '.al' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(20) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(20) : error C2228: left of '.bh' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(21) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(21) : error C2228: left of '.ch' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(22) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(22) : error C2228: left of '.cl' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(23) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(23) : error C2228: left of '.dh' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(24) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(24) : error C2228: left of '.dl' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(25) : error C2065: 'int86' : undeclared identifier
E:\C-Files\Homework\CLS\Cpp2.cpp(37) : error C2079: 'regs' uses undefined union 'REGS'
E:\C-Files\Homework\CLS\Cpp2.cpp(40) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(40) : error C2228: left of '.ah' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(41) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(41) : error C2228: left of '.bh' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(42) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(42) : error C2228: left of '.dh' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(43) : error C2228: left of '.h' must have class/struct/union type
E:\C-Files\Homework\CLS\Cpp2.cpp(43) : error C2228: left of '.dl' must have class/struct/union type
Error executing cl.exe.
Cpp2.obj - 25 error(s), 0 warning(s)
And this is the C++ code:
#include<stdio.h>
#include<dos.h>
#include<conio.h>
#include<stdlib.h>
#define VIDEO 0x10 //Video Interrupt
#define COLS 80 //Screen Width
#define ROWS 25 //Screen Rows
void cls(void);
void locate(int col, int row);
void cls(void)
{
union REGS regs;
regs. h . ah=0x06; //func 6, scroll window
regs. h . al=0x00; //clear screen
regs. h . bh=0x07; //make screen "blank"
regs. h . ch=0x00; //Upper left row
regs. h . cl=0x00; //Upper left column
regs. h . dh=ROWS - 1; //Lower right row
regs. h . dl=COLS - 1; //Lower right column
int86(VIDEO,&regs,&regs);
locate(0,0); //"Home" the cursor
}
/* LOCATE Function
Moves the cursor to position col,row, where col ranges from 0 to 79 and row from
0 to 24. Upper left corner = 0,0; lower right corner = 79,24
*/
void locate(int col, int row)
{
union REGS regs;
regs. h . ah=0x02; //Vid func 2, move cursor
regs. h . bh=0x00; //Video screen (always 0)
regs. h . dh=row; //Cursor's row position
regs. h . dl=col; //Cursor's column position
int86(VIDEO,&regs,&regs);
}
I have to hand this in by tommorow
Thanks,
Viper-Frag
