4

I have developed a graphic program on a desktop system. But when I tried to run it on the hp compaq laptop it's not getting executed. I developed it using Turbo C. Then i tried writing a simple graphic program in Turbo C on the laptop, but the problem I am getting is in 'initgraph' statement it is unable to detect the driver.

Can you please tell me what might be the problem?

genpfault
  • 51,148
  • 11
  • 85
  • 139
PrithviRaj
  • 571
  • 1
  • 7
  • 15

6 Answers6

11

Turbo-C, much like my first girlfriend, will always have a special place in my heart.

But its time to let her go. She's not the same girl you remember, and just cannot keep up with modern times. She may have been hip and cool at the time, but she can't handle modern trends at all. Even 32-bit memory is a real challenge for her. You're a better man now, and deserve a real woman. Go find yourself a good Visual Studio, or a nice GCC environment.

I'm not saying you have to forget Turbo-C. I know she was your first and will always be magical, but put her pictures in a shoebox, and don't take them out more than once a year. Its time to move on, buddy.

abelenky
  • 63,815
  • 23
  • 109
  • 159
  • 3
    I still play games from 1992. There's newer games out there. But I still want to play some old ones. Why? It's fun. Same goes for ancient compilers. Programming can not only be a job, but a fun hobby too. If someone asks how to get a high score in Donkey Kong, I won't reply with "let go of Donkey Kong and play Call of Duty 8". – Nikos C. May 03 '16 at 13:40
1

I'm assuming that all the other prerequisites like linkers are satisfied.

Now, as we know the BGI folder is usually in the following path(i.e. if you've followed the default installation):

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

As you can see the BGI folder is inside "TurboC3" and not TC. So the code you need to put in your program is as follows,

initgraph(&gd, &gm, "C:\\TurboC3\\BGI");

I hope this helps :) Happy graphics programming :D

Theja
  • 2,448
  • 3
  • 14
  • 18
1

It sounds like it can't detect what kind of graphics card you have. Try setting the graphdriver parameter to either VGA or IBM8514.

Gabe
  • 84,912
  • 12
  • 139
  • 238
1

In Turbo c goto options->Linker->Liabraries-> add Graphics Library. It might help

Saffhire
  • 11
  • 1
  • 1
  • 2
-1

you need to initialize the graphics function first. below is the code to initialize.

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

this will initialize the graphics.

-3

The Steps to make your TC able to run graphics program are as follows:

  1. copy CGA.BGI and EGAVGA.BGI files from TC\BGI folder and paste them in TC\BIN directory.

  2. Open TC by clicking on TC\BIN\TC.EXE.

  3. Click on Options -> Linker -> Libraries .

  4. Select the Graphics Library option and Press OK.

  5. Now you can compile your graphics program with Zero Compilation Errors.

Thanks!