User Tools

Site Tools


c:graphics.h:registerbgidriver

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:graphics.h:registerbgidriver [2015/05/06 23:06]
c:graphics.h:registerbgidriver [2024/02/16 01:05] (current)
Line 1: Line 1:
 +===== registerbgidriver =====
 +
 +
 +====Syntax of registerbgidriver ==== 
 + <code c>
 +#include <graphics.h>
 +int registerbgidriver(void (*driver)(void));
 +  </code>
 +
 +
 +==== Description of registerbgidriver ==== 
 +<code c>
 +registerbgidriver enables a user to load a driver file and "register" the
 +driver. Once its memory location has been passed to registerbgidriver,
 +initgraph uses the registered driver. A user-registered driver can be
 +loaded from disk onto the heap, or converted to an .OBJ file (using
 +BGIOBJ.EXE) and linked into the .EXE.
 +Calling registerbgidriver informs the graphics system that the driver
 +pointed to by driver was included at link time. This routine checks the
 +linked-in code for the specified driver; if the code is valid, it
 +registers the code in internal tables.
 +By using the name of a linked-in driver in a call to registerbgidriver,
 +you also tell the compiler (and linker) to link in the object file with
 +that public name.
 +</code>
 +
 +
 +==== Example of registerbgidriver ====
 +<code c>
 +/* registerbgidriver example */
 +
 +#include <graphics.h>
 +#include <stdlib.h>
 +#include <stdio.h>
 +#include <conio.h>
 +
 +int main(void)
 +{
 +   /* request autodetection */
 +   int gdriver = DETECT, gmode, errorcode;
 +
 +   /* register a driver that was added into GRAPHICS.LIB */
 +   errorcode = registerbgidriver(EGAVGA_driver);
 +
 +   /* report any registration errors */
 +   if (errorcode < 0) {
 +printf("Graphics error: %s\n", grapherrormsg(errorcode));
 +printf("Press any key to halt:");
 +getch();
 +
 +exit(1);   /* terminate with an error code */
 +   }
 +
 +   /* 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:");
 +getch();
 +exit(1);   /* terminate with an error code */
 +   }
 +
 +
 +   /* draw a line */
 +   line(0, 0, getmaxx(), getmaxy());
 +
 +   /* clean up */
 +   getch();
 +   closegraph();
 +   return 0;
 +}
 +</code>
 +
 +
 +==== See also ====
 +[[graphresult]]
 +[[initgraph]]
 +[[installuserdriver]]
 +[[registerbgifont]]
 +
 +
 +===== output of registerbgidriver example ===== 
 +
 +    no output of example at the moment
 +    do not hesitate and add it...  
 +
 +
  

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War

Impressum Datenschutz