Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BGI error, How to Resolve it?

Tags:

c

turbo-c

bgi

I want to run a C program that draws a circle. The program is compiling with no error and it is running. After getting the values like radius from the user, I get the error like this :

BGI error: Graphics not initialized ( use "initgraph")

Even though in my source code I have added this line :

int gmode,gdrive=DETECT;
initgraph(&gdrive,&gmode,"c\\tc\\bgi");

Still I'm getting error.

I'm using Windows and I couldn't figure out where I went wrong. Can anyone help me in this regard?

Thanks in advance.

like image 886
sriram Avatar asked Sep 30 '11 04:09

sriram


2 Answers

Your path in initgraph is wrong. Use "c:\\tc\bgi" instead.

like image 94
Jesus Ramos Avatar answered Sep 26 '22 15:09

Jesus Ramos


Try this (it worked for me) :

The BGI folder is usually in the following path,

C:\TurboC++\disk\TurboC3\BGI

So the code you need to put in your program is as follows,

initgraph(&gd, &gm, "C:\\TurboC3\\BGI");
like image 45
Theja Avatar answered Sep 26 '22 15:09

Theja