I use Borland C++ Compiler 5.5,which runs in DOS, I just put bcc32 and the source code (the .cpp file that has source code) and it compiles it. Well I am having the following problem while trying to call a DOS function. Here is my program:
Code:
#include <stdio.h>
#include <dos.h>
void main()
{
int major,minor;
union REGS regs; //required for making DOS calls
regs.h.al=1; //Get version number
regs.h.ah=0x30; //Get version function 30h
int86(0x21, & regs, & regs); //Call DOS
major=regs.h.al; //Get major version no.
minor=regs.h.ah; //Get minor version no.
printf("This is DOS version %i, release %i",major,minor);
}
NOTE: In Line 11 & and regs are supposed to be joined, but if I join it posts this sign ®.
I get a lot of error messages and it won't compile my program. Here are the error messages:
Error E2450 dosver.c 7: Undefined structure 'REGS' in function main
Error E2449 dosver.c 7: Size of 'regs' is unknown or zero in function main
Error E2450 dosver.c 7: Undefined structure 'REGS' in function main
Error E2450 dosver.c 7: Undefined structure 'REGS' in function main
Error E2449 dosver.c 7: Size of 'regs' is unknown or zero in function main
Error E2451 dosver.c 9: Undefined symbol 'h' in function main
Error E2451 dosver.c 10: Undefined symbol 'h' in function main
Warning W8065 dosver.c 11: Call to function 'int86' with no prototype in function main
Error E2451 dosver.c 12: Undefined symbol 'h' in function main
Error E2451 dosver.c 13: Undefined symbol 'h' in function main
*** 9 errors in Compile ***
I have taken this program from a C book (C for Dummies Volume One), and I copied it exactly, but it still doesn't work. Can anyone help me?