Thursday, July 30, 2009

Trouble with graphics driver in Turbo c++!?

My Turbo c++ compiler gives an error message "Graphics driver not initialized please use initgraph".Even after using initgraph my compiler says the same problem?

Trouble with graphics driver in Turbo c++!?
Maybe you got the parameters wrong and initgraph failed to initialize, or maybe the BGI file is missing. The correct parameters are:





initgraph(int *driver, int* mode, char* path);





You would typically use DETECT as the driver, in which case the best possible drivers will be detected.





int gd=DETECT, gm;





You might want to specify the path to the graphics driver, which is EGAVGA.BGI for VGA modes (the typical mode). Make sure that it is in the computer. If TC is installed in C:\TC, do a search with the command (after CDing into C:\TC) with DIR EGAVGA.BGI /S


If it is there somewhere, you will see the path. If it is present in (say) C:\TC\BGI, you have to give the third parameter as


"C:\\TC\\BGI".


So, initgraph would typically be:





int gd=DETECT, gm;


initgraph(%26amp;gd, %26amp;gm, "C:\\TC\\BGI");


No comments:

Post a Comment