![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Sep 2005
Posts: 28
Rep Power: 0
![]() |
Can anyone tell me wha next code doesn't compile:
#include <stdio.h>
#include <dos.h>
union REGS regs;
main(argc, argv)
int argc;
char *argv[];
{
if (argc == 2)
modeset(atoi(argv[1]));
if (argc != 2)
printf("EGA Mode is %d", modeget());
}
modeset(mode)
int mode;
{
regs.h.a1 = mode;
regs.h.ah = 0;
int86(0x10, ®s, ®s);
}
modeget(){
regs.h.a1 = 0;
regs.h.ah = 0x0f;
int86(0x10, ®s, ®s);
return(regs.h.a1);
}![]() |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
Join Date: Oct 2005
Posts: 134
Rep Power: 3
![]() |
The list of compiler errors would help so I don't have to go looking through dos.h
![]() |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Sep 2005
Posts: 28
Rep Power: 0
![]() |
--------------------Configuration: MODEGA - Win32 Debug--------------------
Compiling... MODEGA.C D:\zabavni_projekti\MODEGA.C(4) : error C2079: 'regs' uses undefined union 'REGS' D:\zabavni_projekti\MODEGA.C(11) : warning C4013: 'modeset' undefined; assuming extern returning int D:\zabavni_projekti\MODEGA.C(11) : warning C4013: 'atoi' undefined; assuming extern returning int D:\zabavni_projekti\MODEGA.C(14) : warning C4013: 'modeget' undefined; assuming extern returning int D:\zabavni_projekti\MODEGA.C(20) : error C2224: left of '.h' must have struct/union type D:\zabavni_projekti\MODEGA.C(21) : error C2224: left of '.h' must have struct/union type D:\zabavni_projekti\MODEGA.C(22) : warning C4013: 'int86' undefined; assuming extern returning int D:\zabavni_projekti\MODEGA.C(26) : error C2224: left of '.h' must have struct/union type D:\zabavni_projekti\MODEGA.C(27) : error C2224: left of '.h' must have struct/union type D:\zabavni_projekti\MODEGA.C(29) : error C2224: left of '.h' must have struct/union type D:\zabavni_projekti\MODEGA.C(29) : warning C4033: 'modeget' must return a value Error executing cl.exe. MODEGA.OBJ - 6 error(s), 5 warning(s) |
|
|
|
|
|
#4 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Looks like Visual C++ to me. No one's supported DOS.H for absolutely ages - it's ancient. Now, why would you want to check for EGA mode when you're running Windows?
|
|
|
|
|
|
#5 |
|
Hobbyist Programmer
Join Date: Oct 2005
Posts: 134
Rep Power: 3
![]() |
1. Try "union _REGS" instead of "union REGS"
2. Try "_int86" instead of "int86". 3. You need to include stdlib.h to use atoi() 4. You either need to declare prototypes for modeget and modeset before they are used (or you could just move main to the bottom of the file). 5. modeget is declared to return a int. If you forgot to return the value, put it in. If there is nothing to return, the return type should be "void". |
|
|
|
|
|
#6 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,198
Rep Power: 5
![]() |
Close Kaja. modeset() can be declared void with modern compilers. modeget() is returning a value.
The basic problem, as Ooble has said, is that this is code that worked with an ancient compiler not working with a modern compiler. The form of function definitions; main(argc, argv) int argc; char *argv[]; int main(int argc, char *argv[]) |
|
|
|
|
|
#7 | |
|
Professional Programmer
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 3
![]() |
Quote:
![]() |
|
|
|
|
|
|
#8 |
|
Newbie
Join Date: Sep 2005
Posts: 28
Rep Power: 0
![]() |
Which is that ancient compiler? Where can I get(download) it?
Is Turbo C sufficient? |
|
|
|
|
|
#9 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Why would you want to run this program within Windows anyway? EGA is a buzzword for a 640x350 resolution with 4-bit colour. It's been obsolete since 1990 at the very latest.
|
|
|
|
|
|
#10 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
An ancient compiler isn't necessarily good enough. The code emitted would in many cases be regurgitated at runtime by today's more protective OSes.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|