Thread: graphics

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    34

    graphics

    hi every one

    i want to draw a circle using graphics
    Code:
    #include<stdio.h>
    #inlcude<graphics.h>
    {
    circle(20,20,10);
    getch();
    }
    but i am getting display in run time as
    Code:
    BGI ERROR:graphics not initialised(use initgraph)
    can any one tell me where to use initgraph?

    thank you all

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Like the error message says, you need to call initgraph() first.

    You could also do with a more modern compiler for your more modern OS (I'm guessing).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732
    It looks like you are using some old compiler, just a guess Turbo C compiler? It an very old compiler which is not support any more. Why not try some new compiler. Perhaps you could use a modern library for graphics as well. If you are on UNIX envi use Openly or if you are windows use DirectX you could even use OpenGL on windows as well.

    To just point out a good compiler with the IDE use Dev-C++ is good.

    ssharish2005

  4. #4
    Registered User
    Join Date
    Aug 2007
    Posts
    34
    i am using a turbo c2 compiler

    also plz tell me syntax of initgraph();
    THANK YOU all for the help

  5. #5
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732
    Code:
    void initgraph(int far *graphdriver, int far *graphmode, char far *pathtodriver);
    An example

    Code:
    int gd=DETECT, gm;
    
    initgraph(&gd, &gm, "c:\\turboc3\\bgi " );
    ssharish2005

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Turtle Graphics, how does it work?
    By freddyvorhees in forum C++ Programming
    Replies: 15
    Last Post: 08-28-2009, 09:57 AM
  2. Graphics Programming :: Approach and Books
    By kuphryn in forum Windows Programming
    Replies: 4
    Last Post: 05-11-2004, 08:33 PM
  3. egavga.bgi problem
    By sunil21 in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 09-22-2003, 05:06 PM
  4. Graphics Devices and Cprintf clash
    By etnies in forum C Programming
    Replies: 6
    Last Post: 05-09-2002, 11:14 AM