Bgi Error: Graphics not initialized (use initgraph)

Status
Not open for further replies.

freak_pkp

Right off the assembly line
I have made a program in c++. My program is running fine, but at the
end of the program there is a error message on the screen:

Bgi Error: Graphics not initialized (use initgraph)

My program shows no error message at compile time or at run time.
What's this bgi error? How can I correct this? I have initialized the graphics hardware by using the initgraph function on the main segment
of my program. I am using Borland Turbo c++ compiler 3.1.
[/b]
 

theraven

Technomancer
Code:
For some reason initgraph() failed. To find out why, check
the return value of graphresult(). For example:
#include 
int main(void)
{
    int gerr;   /* graphics error */
    int gdriver = DETECT, gmode;
    /* Initialize graphics using auto-detection and look
    for the .BGI and .CHR files in the C:\TURBOC directory.
    */
    initgraph(&gdriver, &gmode, "C:\\TURBOC");
    if ((gerr = graphresult()) != grOk)
    {
        printf("Error : %s\n", grapherrormsg(gerr));
        exit(1);
    }
    :
}

source: *bdn.borland.com/article/0,1410,17916,00.html
 

Techmastro

Journeyman
bgi error usually occur when valid graphics driver are not loaded.
using initgraph only not solve this problem, you have to give proper path for bgi graphics drivers which are usually find in bgi folder
use this
initgraph(&gd,&gm,"");
where gd=GRAPHICS DRIVER
gm=GRAPHICS MODE
""=path where driver reside
 

knopixd

Right off the assembly line
bgi error

hey bgi means borland graphics interface.
i think u include graphics.h without writting code for graphics mode
here is the code:
#include"graphics.h"
void main()
{
int d=DETECT,m;
initgraph(&d,&m,"c:\tc\bgi");//or mentioned the path of ur turbo c3
printf("%d",d);//this will display which driver u have (u can check it in graphics.h)
printf("%d",m);//which mode resolution
getch();
}
try it in c extention.....
bye
njoy c man
 
Status
Not open for further replies.
Top Bottom