Skip to content

gettextinfo

Thomas Foster edited this page Apr 10, 2021 · 1 revision

Function   Gets text mode video information.

Syntaxvoid gettextinfo(struct text_info *r);

Prototype in   conio.h

Return valuegettextinfo returns nothing; the results are returned in the structure pointed to by r.

See also textattr, textbackground, textcolor, textmode, wherex, wherey, window

Remarks

gettextinfo fills in the text_info structure pointed to by r with the current text video information.

The text_info structure is defined in conio.h as follows:

typedef struct text_info
{
    unsigned char winleft;      /* left window coordinate */
    unsigned char wintop;       /* top window coordinate */
    unsigned char winright;     /* right window coordinate */
    unsigned char winbottom;    /* bottom window coordinate */
    unsigned char attribute;    /* text attribute */
    unsigned char normattr;     /* normal attribute */
    unsigned char currmode;     /* BW40, BW80, C40, or C80 */
    unsigned char screenheight; /* bottom - top */
    unsigned char screenwidth;  /* right - left */
    unsigned char curx;         /* x coordinate in current window */
    unsigned char cury;         /* y coordinate in current window */
} TEXT_INFO;

Example

#include <conio.h>

struct text_info initial_info;

int main()
{
    gettextinfo(&initial_info);

    /* ... */

    /* Restore text mode to original value */
    textmode(initial_info.currmode);
    return 0;
}

Header Files

Clone this wiki locally