Initializing Graphics
Initializing Graphics
inigraph() initializes the graphics system.
To start the graphics system, u must call this function.
Syntax :
initgraph(int far &graphdriver,int far &graphmode,char far pathtodriver);
This function initializes the graphics system by loading a graphics driver from disk then putting the system into graphics mode.
It also resets all graphics settings(color,current position) to their defaults.
Note : '&' sign has to be placed before the first two arguments. As this is the address of location from which driver has to be loaded.
Arguments used :
graphdriver:
Integer that specifies the graphics driver to be used.
graphmode :
Integer that specifies the initial graphics mode.
If graphmode==DETECT then initgraph sets *graphmode to the highest resolution
available for the detected driver.
pathtodriver :
Specifies the directory path where initgraph looks for graphics driver(*.BGI) first.
Suppose you have TC folder in c drive that contains lib,bgi and other folders, then your
pathtodriver will be :
c:\\tc\\bgi
that is you set the path by typing :
name of drive where your turbo c is present//turbo c folder name//bgi
Example:
#include <graphics.h>
#include <conio.h>
void main()
{
int d,m;
d=DETECT;
initgraph(&d,&m,"c:\\tc\\bgi"); //notice that '&' is placed before the first two arguments
circle(100,100,20);
closegraph();
}
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment