getdrivername
raw OCR
Returns a pointer to a string containing the name of the current graphics driver.
Defined in header <graphics.h>
Syntax
#include <graphics.h>
char *far getdrivername(void);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ |
Remarks
After a call to initgraph, getdrlvername returns the name of the driver that is currently loaded.
Return value
getdrlvername returns a pointer to a string with the name of the currently loaded graphics driver.
See also
Example
#include <graphics.h>
iinclude <stdlib.h>
#include <stdio.h>
#include <conio.h>
int mainO
{
/* request autodetection */
int gdriver = DETECT, gmode, errorcode;
/* stores the device driver name */
char *drivername;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");
/* 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:");
getchO ;
exit(l); /* terminate with an error code */
}
setcolor(getmaxcolor (
/* get the name of the device driver in use */
drivername = getdrivername ();
/* for centering text onscreen */
settextjustify (CENTER_TEXT, CENTER_TEXT) ;
/* output the name of the driver */
outtextxy (getmaxxO / 2, getmaxyO / 2, drivername);
/* clean up */
getchO ;
closegraphO ;
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Extraction notes
- heading `getdrivernanne` read as `getdrivername`
Stable link: /3.1/graphics.h/getdrivername/
· short form /3.1/getdrivername/