Bgi Error: Graphics not initialized (use initgraph)
Menu

digit

 

Results 1 to 4 of 4

Thread: Bgi Error: Graphics not initialized (use initgraph)

  1. #1
    Right off the assembly line
    Join Date
    Mar 2005
    Posts
    1

    Default Bgi Error: Graphics not initialized (use initgraph)

    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]

  2. #2
    Human Spambot
    Join Date
    May 2004
    Location
    off to "never ever" land
    Posts
    2,912

    Default

    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: http://bdn.borland.com/article/0,1410,17916,00.html
    No Mercy, No Limits.
    Oobertech.net - Keeping Knowledge Free

  3. #3
    In The Zone
    Join Date
    Mar 2005
    Location
    Right behind you...
    Posts
    218

    Default

    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

  4. #4
    Right Off the Assembly Line
    Join Date
    Mar 2005
    Posts
    4

    Default 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

Similar Threads

  1. Intel HD Graphics with Dedicated Graphics Card
    By RBX in forum Hardware Q&A
    Replies: 5
    Last Post: 02-08-2011, 03:16 AM
  2. Replies: 1
    Last Post: 19-06-2008, 12:39 AM
  3. Replies: 17
    Last Post: 04-08-2007, 02:47 PM
  4. Replies: 1
    Last Post: 10-07-2006, 03:28 AM
  5. Error error error....gives me hell of a terror
    By abhilash in forum QnA (read only)
    Replies: 4
    Last Post: 06-11-2004, 12:41 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •