-
I am beginner at C++, and I have a few problems with the BGI!
I have tried the following code:
Code:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
/* request autodetection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy, i;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) { /* an error occurred */
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
/* loop through the fill patterns */
for (i=EMPTY_FILL; i<USER_FILL; i++) {
/* set the fill style */
setfillstyle(i, getmaxcolor());
/* draw the 3-d bar */
bar3d(midx-50, midy-50, midx+50, midy+50, 10, 1);
getch();
}
/* clean up */
closegraph();
return 0;
}
But I get the following error:
Graphics error: Device driver file not found (EVAVGA.BGI)
Press any key to halt:
But I have checked my C:\bc45\bgi\ dir, and I found the EVAVGA.BGI file there!!!???
Whats wrong!!!???
[Edited by CyberCarsten on 08-11-2000 at 02:24 PM]
-
Is the BGI dir in your %PATH%?
-
What do your mean by %PATH% ??
-
It's an environment variable. Open up a console window, and type "set" (without the quotes). A list of environment variables will be displayed, and there should be a PATH entry there. %PATH% is the syntax for referencing the contents.
-
I dont know what this means....I'm new to C++
-
This isn't C++, it's basic DOS stuff. Did you never use DOS?
-
-
Naturally. Anyway, quick fix time. Open up a console window, and navigate to the folder with your app in. Then type:
Code:
SET PATH=%PATH%;C:\BC45\BGI
Then run your program.
-
Thank you!! I'll try that!!
-
It still doesn't work....
-
Hmmmmmmmmm. Do any drivers need to be loaded at startup for it to work?
-
I dont't know....it was a sample program, I found in the help file...
-
Oh yeah, it's the dodgy Borland sample apps. Few of the ones I tried actually worked :(. Try copying the driver files to your c:\windows\command folder.
-
I'm running Win 2000 Pro, and I tried to copy the files in \BC45\BGI to the C:\winnt\system32 dir, but it didn't work...
-
Win2000...this changes everything. Win2000 is based on NT and as such blocks off direct hardware access, so I doubt that your program will be able to do anything. Most graphics under Win2K has to be done through DirectX or another Microsoft-certified method.
-