Borland C++ reference

getmodename

raw OCR

Returns a pointer to a string containing the name of a specified graphics mode.

Defined in header <graphics.h>

Syntax

#include <graphics.h>
char *far getmodename(int modejtumber);

Portability

DOSUNIXWindowsANSI CC++ only
■

Remarks

getmodename accepts a graphics mode number as input and returns a string containing the name of the corresponding graphics mode. The mode names are embedded in each driver. The return values ( "320x200 CGA PI/' "640x200 CGA", and so on) are useful for building menus or displaying status.

Return value

getmodenamereturns a pointer to a string with the name of the graphics

mode.

See also

Example

#include <graphics..h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
   /* request autodetection  */
   int gdriver = DETECT, gmode,  errorcode;
   int midx, midy, mode;
   char numname [80], modename[80];
   /* initialize graphics and  local variables */
   initgraph(&gdriver, Scgmode, "");
   /* read result of initialization  */
   errorcode = graphresult ();
   if (errorcode  != grO]<:) { /* an error occurred */
      printf("Graphics error:  %s\n", grapherrormsg(errorcode));
      printf("Press any key  to halt:");
      getchO ;
      exit(l);                /* terminate with an error code */
   }
   midx = getmaxx () / 2;
   midy = getmaxy () / 2;
   /* get mode number and name  strings */
   mode = getgraphmode ();
   sprintf(num[name, "%d is the current mode number.", mode);
   sprintf(modename,  "%s is the current graphics mode.", getmodename (mode));

   /* display the information  */
   settextjustify (CENTER_TEXT, CENTER_TEXT);
   outtextxy(midx, midy, numname);
   outtextxy(midx, midy+2*textheight ("W"), modename);

   /* clean up  7
   getchO ;
   closegraphO
return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.