Question:
C++ graphics EGAVGA.BGI problem.....?
Anshul Jindal
2013-07-29 03:00:27 UTC
Hello!!!!
The following is a graphics program that was written in my book:

int gdriver=DETECT,gmode,errorcode;
int midx,midy,x;
initgraph(&gdriver, &gmode, "d:\\bc3\\bgi");
errorcode= graphresult();
if(errorcode!=grOk)
{
printf("Graphics error occured: %s \n", grapherrormsg(errorcode));
printf("Press any key to stop :");
getch();
exit(1);
}
for(x=15;x>=0;x--)
{
setcolour(x);
circle(20+(x*40),200,15);
getch();
}
cleardevice();
circle(200,200,50);
getch();
closegraph();


the error message says that the egavga.bgi file is missing.
I browsed the internet for solutions and the only one i got was to write "initgraph(&gdriver, &gmode, "c:\\tc\\bgi");"
I tried this too but failed.......
But I think that the reason for this is that i'm using windows 7 and the egavga.bgi file is stored in "C:\ TurboC++\ Disk\ TurboC3\ BGI\ Disk\ TurboC3\ BGI\ Disk\ TurboC3\ BGI"
There is actually no space between the file location.......
i got this location by searching for the file in my computer and opening the location

I don't know what to do....
Please help!!!
Three answers:
Jonathan
2013-07-29 03:29:06 UTC
I honestly haven't used TurboC in decades. It's very old. (I'm older.) Windows has changed so much, too. When TurboC was being developed and sold, Windows was all based upon a DOS launch (meaning you had DOS installed and Windows started as a program from there) and ran with 16-bit segmentation. Directories were MUCH simpler then, as well. You couldn't use anything like the names you can now. And the method that programs used to find bits and pieces of themselves has evolved more than once since then. Back then, it was done with ENVIRONMENT VARIABLES that you'd set to help the program find itself. Next came the Windows registry (and a few different ways of using it.) ANd there are changes since that, too. Running an OLD program on a modern O/S will require some knowledge to make it work.



I see in your sample code that there is a parameter to the initgraph() function that specifies a directory ending in BGI. It's possible that this parameter is needed so that the graphing code and go look in that directory for the file it is complaining about. If that's the case, I'm sure you can see the difference between that value and where you said the file actually is at. That could be your problem. You may need to modify the code, appropriately.



Another problem may crop up. New Windows can support LONG FILENAMES that simply weren't available before. And new characters are allowed that weren't allowed before, as well. There is a way of using the DIR command in a DOS box, "DIR /X", which will show you how the new modern names can be accessed using OLD naming conventions. Use it to get the modern Windows version of your complete directory path and use that in the parameter and see what happens. Modern Windows accepts two kinds of names, old and new; but old programs ONLY accept old names. So you may need to work that out, as well, to get all this going for you.



Even then, there is another problem. WIndows 7 doesn't emulate everything nearly as well as the earlier Windows systems did (Win 2000 is the ONLY NT-based Windows O/S that did almost as good a job as the older 16-bit O/S's did... but Win 2000 is long gone and all the newer ones do a LOUSY job.) So even if you get everything else working right, it's possible that the old graphics drivers will NOT SEE the right hardware emulation and just fail because of that, too.



You also didn't mention if you are running Win7 64-bit or Win7 32-bit. But I assume it is 32-bit, since you are getting error messages at least.



I'm hoping someone can tell you exactly. But those are my thoughts, not having ever tried to run Turbo C/C++ under Win7.
anonymous
2016-12-13 13:05:43 UTC
Egavga.bgi
anonymous
2016-03-19 07:56:36 UTC
Type in: maybe you can find a line here: int graphdriver = DETECT, graphmode; initgraph(&graphdriver, &graphmode, "..\\bgi"); just type that


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...