Archived

This topic is now archived and is closed to further replies.

nold

Graphics Drivers

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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!!

Share this post


Link to post
Share on other sites