Advertisement

Graphics Drivers

Started by July 26, 2003 03:27 PM
3 comments, last by nold 21 years, 7 months ago
Prepare for an abstract question. Ok, to start of, I have this Borland Turbo C editor. And a graphics library all for DOS. Before I can use the library I must first call a function called inti_graph(). It has three parameters, one for the driver wich I set to Auto detect, the second is the mode wich I set to 256 color mode. Now the one that has me stumped is the third wich is the path to driver. Can anyone tell me what to pass as the path, and what does this mean?
Ummmmm
I did some searching and found two possibilities:

Either pass "" (i.e. the null string)

or the location of the TurboC BGI drivers (something like):

c:\tc\bgi

Although the only reference I found for that one is for TurboPascal so...

Anyway, isn''t it documented?
Advertisement
I tryed that and instead of saying

BGI ERROR: Graphics not initialized (use initgraph)

Whenever it is ran in the environment a message box pops up and says that TC took an illegal instruction and terminates the app. Im sure the anwer is simple, its trying to find it that is so hard...thanks for the suggestion and any more help would be greatly appreciated.

Ummmmm
Ummmmm
A little snipped from a program i wrote some time ago - maybe it helps:

int gdriver = DETECT, gmode, errorcode;/* initialize graphics and local variables */initgraph(&gdriver, &gmode, "d:\\tcdos\\tc\\bgi");/* read result of initialization */errorcode = graphresult();if (errorcode != grOk)  /* an error occurred */{	printf("Graphics error: %s\n", grapherrormsg(errorcode));	printf("Press any key to halt:");	getch();	exit(1); /* terminate with an error code */}.....closegraph(); 



Of course you must change "d:\\tcdos\\tc\\bgi" to the directory where your bgi drivers are located!

hope that helps!

[edited by - BrooksWackerman on July 26, 2003 7:04:11 PM]
Copy the necessary BGI drivers into the path where you''d start your exe.
Or use

initgraph(...,int mode,"C:\\TC\\BGI\\");

Pay attention to the backslash pairs.

Why don''t you use DJGGP (delorie.com) and Allegro for free if you want graphics under DOS...lot of times faster!!

This topic is closed to new replies.

Advertisement